12. As shown in the figure, in rectangle $A B C D$, $A B=2, A D=1, M$ is the midpoint of $D C$. $\triangle A D M$ is folded along $A M$ so that plane $A D M \perp$ plane $A B C M$.
(1) Prove that $A D \perp B M$;
(2) If point $E$ is a moving point on line segment $D B$, at what position of point $E$ is the cosine value of the dihedral angle $E-A M-D$ equal to $\frac{\sqrt{5}}{5}$?
(1) In rectangle $A B C D$,
$$
A M^{2}+B M^{2}=A B^{2} \Rightarrow A M \perp B M \text {. }
$$

Also, plane $A D M \perp$ plane $A B C M$
$\Rightarrow B M \perp$ plane $A D M$,
so $B M \perp A D$.
(2) Let $O$ be the midpoint of $A M$, and establish the coordinate system $O-x y z$ as shown in the figure, then
$$
A\left(\frac{\sqrt{2}}{2}, 0,0\right), D\left(0,0, \frac{\sqrt{2}}{2}\right), M\left(-\frac{\sqrt{2}}{2}, 0,0\right), B\left(-\frac{\sqrt{2}}{2}, \sqrt{2}, 0\right) .
$$

Let $\overrightarrow{D E}=\lambda \overrightarrow{D B}=\frac{\sqrt{2}}{2}(-\lambda, 2 \lambda,-\lambda), \overrightarrow{D A}=\frac{\sqrt{2}}{2}(1,0,-1)$,
then $\overrightarrow{E A}=\overrightarrow{D A}-\overrightarrow{D E}=\frac{\sqrt{2}}{2}(1+\lambda,-2 \lambda,-1+\lambda)$.
The normal vector of plane $A D M$ is $\boldsymbol{m}=(0,1,0)$, and let the normal vector of plane $A E M$ be $\boldsymbol{n}=(x, y, z)$,
thus $\left\{\begin{array}{l}(1+\lambda) x-2 \lambda y+(-1+\lambda) z=0, \\ x=0,\end{array}\right.$ take $y=1 \Rightarrow \boldsymbol{n}=\left(0,1, \frac{2 \lambda}{\lambda-1}\right)$.
Then $\cos \langle\boldsymbol{m}, \boldsymbol{n}\rangle=\frac{1}{\sqrt{1+\left(\frac{2 \lambda}{\lambda-1}\right)^{2}}}=\frac{\sqrt{5}}{5} \Rightarrow \lambda=\frac{1}{2}$.
Therefore, $E$ is the midpoint of line segment $D B$.