[proofplan]
We give an explicit example in the matrix algebra $M_2(\mathbb{C})$ equipped with the normalized trace. The two marginal variables will be rank-one projections, so their one-variable moment sequences agree because every positive power of a projection equals itself. The joint laws will nevertheless differ because the mixed word $XYXY$ has different normalized trace on the two pairs.
[/proofplan]
[step:Construct two rank-one projections in the normalized matrix probability space]
Let $\mathcal{A} := M_2(\mathbb{C})$ be the unital $*$-algebra of complex $2 \times 2$ matrices. Define the state $\tau: M_2(\mathbb{C}) \to \mathbb{C}$ by
\begin{align*}
\tau(T) := \frac{1}{2}\operatorname{Tr}(T)
\end{align*}
for each $T \in M_2(\mathbb{C})$, where $\operatorname{Tr}: M_2(\mathbb{C}) \to \mathbb{C}$ denotes the ordinary matrix trace. Thus $(\mathcal{A},\tau)$ is a finite-dimensional noncommutative probability space.
Let $E_{ij} \in M_2(\mathbb{C})$ denote the matrix unit whose only nonzero entry is a $1$ in row $i$ and column $j$. Define
\begin{align*}
P := E_{11}
\end{align*}
and
\begin{align*}
Q := \frac{1}{2}(E_{11}+E_{12}+E_{21}+E_{22}).
\end{align*}
Set
\begin{align*}
a := P, \qquad b := P, \qquad c := P, \qquad d := Q.
\end{align*}
The elements $P$ and $Q$ are self-adjoint because $E_{11}^* = E_{11}$, $E_{12}^* = E_{21}$, and $E_{22}^* = E_{22}$. Also $P^2=P$. Using the multiplication rule $E_{ij}E_{kl}=\delta_{jk}E_{il}$ for matrix units, one obtains $Q^2=Q$. Hence $P$ and $Q$ are projections.
[/step]
[step:Verify that the two first marginals and the two second marginals have matching moments]
For every positive integer $n$, the projection identity gives $P^n=P$ and $Q^n=Q$. Therefore
\begin{align*}
\tau(a^n)=\tau(P^n)=\tau(P)=\frac{1}{2}\operatorname{Tr}(E_{11})=\frac{1}{2}.
\end{align*}
Similarly,
\begin{align*}
\tau(c^n)=\tau(P^n)=\frac{1}{2}.
\end{align*}
Thus $\tau(a^n)=\tau(c^n)$ for every positive integer $n$.
For the second variables,
\begin{align*}
\tau(b^n)=\tau(P^n)=\frac{1}{2}.
\end{align*}
Since $Q^n=Q$ and $\operatorname{Tr}(Q)=1$, we also have
\begin{align*}
\tau(d^n)=\tau(Q^n)=\tau(Q)=\frac{1}{2}.
\end{align*}
Hence $\tau(b^n)=\tau(d^n)$ for every positive integer $n$.
[guided]
The point of choosing projections is that their higher powers carry no new information. Since $P^2=P$, induction gives $P^n=P$ for every positive integer $n$. For $Q$, use the matrix-unit multiplication rule $E_{ij}E_{kl}=\delta_{jk}E_{il}$ to compute
\begin{align*}
(E_{11}+E_{12}+E_{21}+E_{22})^2 = 2(E_{11}+E_{12}+E_{21}+E_{22}).
\end{align*}
Therefore $Q^2=Q$, and induction gives $Q^n=Q$ for every positive integer $n$.
Now compute the moments using the normalized trace $\tau(T)=\frac{1}{2}\operatorname{Tr}(T)$. The matrix $P=E_{11}$ has ordinary trace $1$, so
\begin{align*}
\tau(P^n)=\tau(P)=\frac{1}{2}\operatorname{Tr}(P)=\frac{1}{2}.
\end{align*}
The matrix $Q$ is also a rank-one projection, so its ordinary trace is $1$. Equivalently, from the displayed formula for $Q$, only the diagonal terms contribute to the trace:
\begin{align*}
\operatorname{Tr}(Q)=\frac{1}{2}\operatorname{Tr}(E_{11}+E_{22})=1.
\end{align*}
Therefore
\begin{align*}
\tau(Q^n)=\tau(Q)=\frac{1}{2}.
\end{align*}
Since $a=c=P$, the first marginal moment sequences agree. Since $b=P$ and $d=Q$ have the same normalized trace in every positive power, the second marginal moment sequences also agree:
\begin{align*}
\tau(a^n)=\tau(c^n)
\end{align*}
and
\begin{align*}
\tau(b^n)=\tau(d^n)
\end{align*}
for every positive integer $n$.
[/guided]
[/step]
[step:Separate the joint laws using the mixed monomial $XYXY$]
Define the noncommutative polynomial $p \in \mathbb{C}\langle X,Y\rangle$ by
\begin{align*}
p(X,Y) := XYXY.
\end{align*}
For the pair $(a,b)=(P,P)$,
\begin{align*}p(a,b)=PPPP=P.\end{align*}
Hence
\begin{align*}\tau(p(a,b))=\tau(P)=\frac{1}{2}.\end{align*}
For the pair $(c,d)=(P,Q)$, first compute
\begin{align*}PQ=\frac{1}{2}(E_{11}+E_{12}).\end{align*}
Using the multiplication rule for matrix units,
\begin{align*}PQPQ=\frac{1}{4}(E_{11}+E_{12}).\end{align*}
Therefore
\begin{align*}\operatorname{Tr}(PQPQ)=\frac{1}{4}.\end{align*}
Applying the normalized trace gives
\begin{align*}\tau(p(c,d))=\tau(PQPQ)=\frac{1}{8}.\end{align*}
Thus
\begin{align*}\tau(p(a,b))=\frac{1}{2}\ne\frac{1}{8}=\tau(p(c,d)).\end{align*}
[/step]
[step:Conclude that equal marginal moments do not determine the joint law]
The joint law of a pair $(x,y)\in \mathcal{A}^2$ is the linear functional $\mu_{x,y}: \mathbb{C}\langle X,Y\rangle \to \mathbb{C}$ defined by
\begin{align*}
\mu_{x,y}(r) := \tau(r(x,y))
\end{align*}
for each $r \in \mathbb{C}\langle X,Y\rangle$. The preceding step exhibits a polynomial $p(X,Y)=XYXY$ such that
\begin{align*}\mu_{a,b}(p)\ne \mu_{c,d}(p).\end{align*}
Therefore the joint laws of $(a,b)$ and $(c,d)$ are different, even though the individual moment sequences of $a$ and $c$ agree and the individual moment sequences of $b$ and $d$ agree. This proves the theorem.
[/step]