Does anyone have an example of a commutative ring $R$ (with a unit) and two non-free $R$-modules $S$ and $T$ such that $S \otimes_R T$ is a non-zero free module?
I only know of classical examples like $\mathbb Q \otimes_\mathbb Z \mathbb Z/n\mathbb Z \cong 0$ and was asked by one of our students of a non-zero example (which I couldn't think of in reasonable time).
I am not even sure, if this exists for commutative rings but it is clear that such $S$ and $T$ don't both contain free sub modules, in particular for $R$ a PID and $S$ and $T$ finitely generated such a thing should not exists (since we have a decomposition into free sub modules and torsion sub modules).
A similar question can be found here (with $R=\mathbb Z$) and the first link in it contains practically my question (without answers).
Here's an example. Let $A$ and $B$ be two nonzero commutative rings and $R=A\times B$. We can consider $A$ and $B$ as $R$-modules, and they satisfy $A\otimes B\cong 0$ and $A\oplus B\cong R$. Taking $S=A\oplus R$ and $T=B\oplus R$, we thus see that $$S\otimes T\cong A\oplus B\oplus R\cong R^2$$ is free but $S$ and $T$ are not free. More generally, $(A^i\oplus B^j)\otimes(A^k\oplus B^l)\cong A^{ik}\oplus B^{jl}$ is free iff $ik=jl$, but the factors are not free unless $i=j$ and $k=l$.