Let's do it more generally. We want to show that, for any family $(M_\lambda)_{\lambda\in\Lambda}$ and for any $N$, the module
$$\DeclareMathOperator{\Hom}{Hom}
\Hom_R\Bigl(\bigoplus_\lambda M_\lambda,N\Bigr)
$$
satisfies the universal property of
$$
\prod_{\lambda}\Hom_R(M_\lambda,N)
$$
If $R$ is commutative, both objects can be seen as $R$-modules, otherwise they're just abelian groups; in case $N$ is an $R$-$S$-bimodule (in particular $N=R$), both objects can be seen as $S$-modules. The proof doesn't change.
Suppose you have a family of morphisms $f_\lambda\colon K\to\Hom_R(M_\lambda,N)$ (in the appropriate category, see above). For each $x\in K$, consider $f_\lambda(x)\colon M_\lambda\to N$; by the universal property of the coproduct, there is a unique $f(x)\colon\bigoplus_\lambda M_\lambda\to N$ such that $f(x)\circ j_\lambda=f_\lambda(x)$. With $j_\lambda$ I denote the structure maps of the coproduct.
Check with the help of uniqueness that we have defined a morphism $f\colon K\to\Hom_R\Bigl(\bigoplus_\lambda M_\lambda,N\Bigr)$ and do the final checks that are needed.
Actually, there's a more categorical proof: the contravariant functor $\Hom_R(-,N)$ has an adjoint on the right, so it takes coproducts into products.
For the counterexample, you may want to find a ring $R$ and a set $A$ such that $R^{\oplus A}$ has not the same cardinality as the product $R^A$.