If a tensor product is free, what can we say about the tensor factors? Here is what I'd like to prove:

Let $R$ be a commutative, noetherian ring, and let $M$ and $N$ be finitely generated $R$-modules.  Suppose $M\otimes_RN\cong R$.  Does it follow that $M\cong N\cong R?$

Whether or not this is true, I'm wondering what conditions are necessary for something like it to be true, that is, what conditions $\star_R$, $\star_M$, and $\star_N$ make the following statement true:

Let $R$ be a ring satisfying $\star_R$, and let $M$ be a right $R$-module satisfying $\star_M$ and let $N$ be a left $R$-module satisfying $\star_N$.  If $M\otimes_RN\cong R$, then $M\cong N\cong R$.

Also, what about higher ranks, that is, what can be said in the case $M\otimes_RN\cong\bigoplus_{i=1}^nR$?  I'd appreciate proofs in the affirmative and/or counter examples.  Thanks!
Edit: In light of Martin's and Qiaochu's responses, is $\text{Pic}(\text{Spec } R)$ trivial when $R$ is local?
 A: This is false. As Martin Brandenburg points out in the comments, the keyword is Picard group. For any commutative ring $R$, there is a group $\text{Pic}(\text{Spec } R)$ consisting of all modules which are invertible with respect to the tensor product, and your claim holds iff the Picard group is trivial (which it is generally not). If $R$ is a Dedekind domain, then this group can be identified with the ideal class group of $R$, so to exhibit a counterexample it suffices to exhibit a ring of integers in a number field which fails to have unique prime factorization. 
For example, take $R = \mathbb{Z}[\sqrt{-5}]$. This fails to have unique prime factorization since $(1 + \sqrt{-5})(1 - \sqrt{-5}) = 2 \cdot 3$. Let $M$ be the ideal $(2, 1 + \sqrt{-5})$ regarded as an $R$-module. Since this is not a principal ideal, $M$ is not a free module. But as it turns out, 
$$(2, 1 + \sqrt{-5}) \otimes (3, 1 - \sqrt{-5}) \cong R.$$
Edit: If $R$ is local, then $\text{Pic}(\text{Spec } R)$ is trivial. This follows from the observation that any element of the Picard group is necessarily (finitely generated and) projective (see, for example, MO) and that any projective module over a local ring is free. 
