[[Linearity of Expectations]] allows us to always separate the [[Expectation#^52e656|expectation]] of $X$ and $Y$ when they are linearly combined (e.g. $X+Y$). However, to do the same for the expectation of a product $X*Y$, we require independence $X \perp Y$.
$ \mathbb E[XY] = \mathbb E[X] * \mathbb E[Y] \quad \text{when } X\perp Y$
To prove this, we assume a function $g(x,y) = x*y$ and calculate its expectation.
$
\begin{align}
\mathbb E [g(X,Y)] &= \sum_x \sum _y g(x,y)*p_{XY}(x,y) \tag{1}\\
&= \sum_x \sum _y (x*y)*p_{XY}(x,y) \tag{2}\\
&=\sum_x \sum_y xy*p_X(x)*p_Y(y) \tag{3} \\
&=\sum_x x*p_X(x) *\sum_y y*p_Y(y) \tag{4} \\
&= \mathbb E[X] * \mathbb E[Y] \tag{5}
\end{align}
$
(3) Applied the property of independence by multiplying marginal PMFs to obtain the joint PMF.
(4) Since $p_X(x)$ does not depend on $y$ we can pull it out and sum all $x$ separately.
Under the independence assumption, we can extended this to any functions of $g(X), h(Y)$.
$ \mathbb E\big[ g(X)*h(X) \big] = \mathbb E\big[g(X)\big] * \mathbb E\big[h(Y)\big] $