TITLE: Picard group vs class group
QUESTION [7 upvotes]: The question.
Let $R$ be a commutative ring. Let $M$ be an $R$-module with the property that there exists an $R$-module $N$ such that $M\otimes_R N\cong R$. Does there always exist an ideal $I$ of $R$ such that $M$ is isomorphic to $I$ as an $R$-module? (I suspect not in this generality)
The background.
Let $R$ be a commutative ring. Here are two groups that one could associate to $R$.

The "class group".

The first group is "inspired by number theory". One takes the ideals of $R$ and observes that they have a natural multiplication defined on them. One defines two ideals $I$ and $J$ to be equivalent if there exist nonzerodivisors $s$ and $t$ such that $sI=tJ$. This relation plays well with the multiplication, giving us a multiplication on the equivalence classes (unless I screwed up; my reference is "back of an envelope calculation"). This makes the equivalence classes into a commutative monoid, and one could define the class group of $R$ to be units of this monoid, i.e. elements with an inverse.
Note: one could instead use fractional ideals. The theory of fractional ideals is often set up only for integral domains, and if I did screw up above then maybe I should have restricted to integral domains. A fractional ideal is defined to be an integral ideal with a denominator so I don't think this changes the group defined here.

The Picard group.

The second group is "inspired by geometry" -- it's the Picard group of $\operatorname{Spec}(R)$. More concretely, take the collection (it's not a set) of isomorphism classes of $R$-modules $M$. This has a multiplication coming from tensor product, and satisfies the axioms of a monoid except that it's not a set. The units of this monoid however are a set, because another back of an envelope calculation seems to indicate that if $M\otimes_R N\cong R$ and we write $1=\sum_i m_i\otimes n_i$, a finite sum, then the $m_i$ generate $M$ as an $R$-module, giving us some control over the size of the units of the monoid -- they're all isomorphic to a quotient of $R^n$ so we have regained control in a set-theoretic sense. The units of the monoid are the second group.
The question comes from me trying to convince myself that these groups are not equal in general (for I don't really expect them to be equal in general). If $R$ is a Dedekind domain (so $\operatorname{Spec}(R)$ is a smooth affine curve) then we have here the classical definition and the fancy definition of the class group of $R$, and the answer to the question is "yes". This is because every rank 1 projective $R$-module is isomorphic to an ideal of $R$; if I recall correctly then more generally every rank $n+1$ projective $R$-module is isomorphic to $I\oplus R^n$ for some ideal $I$ (this is true at least for the integers of a number field) which enables you to compute the zero'th algbraic $K$-group (Grothendieck group) of $R$. But more generally than this I am not sure what is going on.
On the divisors Wikipedia page I read "Every line bundle $L$ on $X$ on an integral Noetherian scheme is the class of some Cartier divisor" which makes me think that the result might be true for Noetherian integral domains, but I don't see the proof even there (perhaps it's standard). The way it's phrased makes me wonder then whether there are non-Noetherian counterexamples.

REPLY [2 votes]: Here is an attempt to generalize somewhat the above-mentioned proof from Hartshorne.
Claim: Let $R$ be a ring whose total ring of fractions $R_{\mathrm{tot}}=S_{\mathrm{nzd}}^{-1}R$ is Artinian. Then any invertible $R$-module is isomorphic to an invertible ideal.
(The hypothesis holds at least in the following two "natural" cases:

$R$ is a domain, which corresponds to the case of integral schemes,
$R$ is a Noetherian ring without embedded components, i.e. $\mathrm{Ass}\,R$ is precisely the set of minimal primes, in which cases the spectrum of $R_{\mathrm{tot}}$ consists precisely of these minimal primes, hence is $0$-dimensional.)

Proof: One proceeds as in the proof from Hartshorne. Given an invertible module $M$, this is a locally free module of constant rank $1$, and so is the $R_{\mathrm{tot}}$-module $M \otimes_R R_{\mathrm{tot}}$. As $R_{\mathrm{tot}}$ is Artinian, any locally free module of rank $1$ is actually a free module of rank $1$, and thus we have
$$M=M\otimes_R R\hookrightarrow M\otimes_R R_{\mathrm{tot}}\simeq R_{\mathrm{tot}}.$$
This realizes $M$ as an $R$-submodule $M'$ of $R_{\mathrm{tot}}$. It is finitely generated (because $M$ is), let us call these generators $a_1/s_1, \dots, a_n/s_n \in R_{\mathrm{tot}}.$ But then $s=s_1s_2 \dots s_n$ is a non-zero divisor of $R$, and we have $sM' \subseteq R$. Thus, $M$ is isomorphic to the invertible ideal $I:=sM'$. $\square$
(I guess that the assumption can be relaxed a bit more, by assuming that $R_{\mathrm{tot}}$ is just a finite direct product of local rings (edit: Actually, even more by simply assuming that $\mathrm{Pic}(R_{\mathrm{tot}})=1$). But I don't know any new "natural" cases that this would provide.)