[guided]Assume $R$ is a UFD in which every nonzero prime ideal is maximal. We must show $R$ is a Dedekind domain with vanishing class group, $\operatorname{Cl}(R) = 0$.
**Noetherian.** We need every ideal of $R$ to be finitely generated. Let $I \trianglelefteq R$ be a nonzero ideal and choose nonzero $a \in I$. Write $a = u p_1^{a_1} \cdots p_k^{a_k}$ with $u \in R^\times$ and $p_i$ irreducible. Each irreducible $p_i$ generates a prime ideal $(p_i)$ (since in a UFD, irreducible implies prime), and each $(p_i)$ is maximal by hypothesis. By the Chinese Remainder Theorem applied to the pairwise coprime ideals $(p_i^{a_i})$:
\begin{align*}
R/(a) \cong \prod_{i=1}^{k} R/(p_i^{a_i}).
\end{align*}
Each factor $R/(p_i^{a_i})$ is a quotient of the local ring $R_{(p_i)}$ at a maximal ideal, hence Artinian. A finite product of Artinian rings is Noetherian, so $R/(a)$ is Noetherian. Every ideal of $R$ containing $(a)$ corresponds to an ideal of $R/(a)$ and is therefore finitely generated. Since every nonzero ideal contains a nonzero element, $R$ is Noetherian.
**Integrally closed.** By [UFDs Are Integrally Closed](/theorems/2938): if $\alpha = a/b \in \operatorname{Frac}(R)$ with $\gcd(a, b) = 1$ satisfies a monic polynomial over $R$, clearing denominators gives $b \mid a^n$, and $\gcd(a, b) = 1$ in a UFD forces $b \in R^\times$, so $\alpha \in R$.
**Krull dimension at most one.** Every nonzero prime ideal is maximal by hypothesis, so there is no chain $(0) \subsetneq \mathfrak{p} \subsetneq \mathfrak{q}$ of prime ideals.
These three properties (Noetherian, integrally closed, Krull dimension $\le 1$) are precisely the Dedekind axioms, so $R$ is a Dedekind domain.
**Vanishing class group.** Why does the UFD property force $\operatorname{Cl}(R) = 0$? In a Dedekind domain, every nonzero ideal factors uniquely as a product of prime ideals. The class group is generated by the classes $[\mathfrak{p}]$ of the nonzero prime ideals. In a UFD, every irreducible element $p$ generates a prime ideal $(p)$, and every nonzero prime ideal $\mathfrak{p}$ has height one. We claim each $\mathfrak{p}$ is principal. Let $0 \neq a \in \mathfrak{p}$. Since $R$ is a UFD, factor $a = u p_1 \cdots p_m$ into irreducibles. Then $a \in \mathfrak{p}$ implies some $p_j \in \mathfrak{p}$ (since $\mathfrak{p}$ is prime), so $(p_j) \subset \mathfrak{p}$. But $(p_j)$ is a nonzero prime ideal (irreducible implies prime in a UFD), hence maximal, so $(p_j) = \mathfrak{p}$. Since every prime ideal is principal, every ideal $\mathfrak{a} = \mathfrak{p}_1^{e_1} \cdots \mathfrak{p}_r^{e_r} = (p_1^{e_1} \cdots p_r^{e_r})$ is principal. Therefore $\operatorname{Cl}(R) = 0$.
The key insight is that UFD and Dedekind interact powerfully: the UFD condition makes all prime ideals principal, and in a Dedekind domain every ideal is a product of primes, so all ideals are principal. The counterexample $\mathbb{Z}[\sqrt{-5}]$ is Dedekind but not a UFD ($6 = 2 \cdot 3 = (1 + \sqrt{-5})(1 - \sqrt{-5})$), and correspondingly $\operatorname{Cl}(\mathbb{Z}[\sqrt{-5}]) \cong \mathbb{Z}/2\mathbb{Z} \neq 0$.[/guided]