More precisely, let $X$ and $Y$ be two orthogonal vectors in some tangent space $T_xM$ and assume that the exponential map sends (a neighbourhood of 0 of) the plane spanned by $X$ and $Y$ into a totally geodesic surface $S$. If you denote $\gamma_s(t)=exp_x(t(X\cos(s)+Y\sin(s)))$, then $$J:=\frac{\partial\gamma}{\partial s}$$ is a Jacobi field along the geodesic $\gamma_0$ and thus satisfies (denoting $\gamma_0$ by $\gamma$): $$\nabla^2_{\dot\gamma,\dot\gamma}J=-R_{J,\dot\gamma}\dot\gamma.$$ Since $J$ and $\dot\gamma$ are tangent to $S$, which is totally geodesic, and moreover $R_{J,\dot\gamma}\dot\gamma$ is orthogonal to $\dot\gamma$, we see that $R_{J,\dot\gamma}\dot\gamma$ ahs to be proportional to $J$. A standard argument then shows that $M$ has constant scalar sectional curvature (provided that $dim(M)>2$). I can give more details about this if you need.
More precisely, let $X$ and $Y$ be two orthogonal vectors in some tangent space $T_xM$ and assume that the exponential map sends (a neighbourhood of 0 of) the plane spanned by $X$ and $Y$ into a totally geodesic surface $S$. If you denote $\gamma_s(t)=exp_x(t(X\cos(s)+Y\sin(s)))$, then $$J:=\frac{\partial\gamma}{\partial s}$$ is a Jacobi field along the geodesic $\gamma_0$ and thus satisfies (denoting $\gamma_0$ by $\gamma$): $$\nabla^2_{\dot\gamma,\dot\gamma}J=-R_{J,\dot\gamma}\dot\gamma.$$ Since $J$ and $\dot\gamma$ are tangent to $S$, which is totally geodesic, and moreover $R_{J,\dot\gamma}\dot\gamma$ is orthogonal to $\dot\gamma$, we see that $R_{J,\dot\gamma}\dot\gamma$ ahs to be proportional to $J$. A standard argument then shows that $M$ has constant scalar curvature (provided that $dim(M)>2$). I can give more details about this if you need.