Maxfield and Minc (1962) in their paper entitled *On the matrix equation $X'X=A$*, quote an example due to Hall (1958), *A survey of combinatorial analysis*, which shows that for $M\ge 5$ we can find counterexamples of the desired kind. Here is their example:

> The matrix $$A = \begin{bmatrix}
1 & 0 & 0 &1/2 & 1/2\\\\
0 & 1 & 3/4 & 0 & 1/2\\\
0 & 3/4 & 1 & 1/2 & 0\\\\
1/2 & 0 & 1/2 & 1 & 0\\\\
1/2 & 1/2 & 0 & 0 & 1
\end{bmatrix}$$
is positive semidefinite, yet there is no matrix $X$ with nonnegative entries such that $X^TX=A$.

The eigenvalues of the above matrix are approximately (2.12,1.42,1.25,.20,0), where the $0$ is exact as this matrix has rank-4.