An ideal that is maximal among non-finitely generated ideals is prime. I've been doing some old exam problems and I've come across a problem that I've answered, but my gut is telling me that there's something I'm glossing over.

Let $R$ be a commutative ring with identity and let $U$ be an ideal that is maximal among non-finitely generated ideals of $R$. I wish to show that $U$ is a prime ideal.

Assume that $U$ is not prime. Let $x, y\not\in U$ be such that $xy\in U$. $U$ is contained in a maximal ideal $M$ and $xy\in M$, so either $x$ or $y$ is in $M$; assume $x\in M$. The condition $U\subset M$ then implies that there is a ring homomorphism
$$\varphi: R/M\to R/U$$
Since $R/M$ is a field, $\varphi$ is injective. Hence, $\varphi(x)\in U$. This is a contradiction, so $U$ must be prime.
The thing that worries me is that I never explicitly used the hypothesis that $U$ was not finitely generated or the result that $M$ must be finitely generated.
 A: @DonAntonio and @rschwieb have already completely answered this question, but, for posterity, I'd like to give another argument that I think is fairly slick. Suppose $U$ is not prime, so that there exist $x_1,x_2\notin U$ with $x_1x_2\in U$. Define $J_l=U+\langle x_l\rangle$ for each $l\in\{1,2\}$; note that $J_1J_2\subseteq U$. Also, since each $J_l$ strictly contains $U$, both $J_1$ and $J_2$, and hence $J_1J_2$ also, are finitely generated. Now, since every ideal strictly containing $U$ is finitely generated, the ring $R\big/J_1$ is Noetherian.  On the other hand, the quotient $J_2\big/J_1J_2$ is naturally an $R\big/J_1$-module, and, since $J_2$ is finitely generated as an $R$-module, the $R\big/J_1$-module $J_2\big/J_1J_2$ is finitely generated as well. But a finitely generated module over a Noetherian ring is a Noetherian module, so $J_2\big/J_1J_2$ is Noetherian. In particular, the submodule $U\big/J_1J_2$ of $J_2\big/J_1J_2$ is finitely generated, say by elements $a_1+J_1J_2,\dots,a_n+J_1J_2$. Now we have $U=J_1J_2+\langle a_1,\dots,a_n\rangle$, and, since $J_1J_2$ is finitely generated, $U$ thus is also, a contradiction.
A: I propose the following: suppose $\,U\,$ is not prime, thus there exist $$\,x,y\in R \text{ such that }x,y\notin U\,,\,xy\in U\,.$$ Define now $B:=U+\langle y\rangle$.
By maximality of $\,U\,$ we have that $\,B\,$ is f.g., say $$\,B=\Bigl\langle u_i+r_iy\,,\,1\leq i\leq k\,,\,k\in\mathbb{N}\,\,;\,\,u_i\in U\,,\,r_i\in R\Bigr\rangle$$ and let now $$U_y:=\{s\in R\,\,;\,\,sy\in U\}.$$ (1) Check that $\,U_y\,$ is a proper ideal in $\,R\,$.
(2) Show that $\,U_y\,$ is f.g.
Put $\,U_y=\langle s_1,\ldots,s_m\rangle\,$, and take $\,u\in U\Longrightarrow\,\exists  v_1,\ldots,v_k, t_1,\ldots,t_k\in R\,\,s.t.$$$u=\sum_{n=1}^kv_nu_n+\sum_{n=1}^kt_nr_ny.$$ 
(3) Show that $\displaystyle{\sum_{n=1}^kt_nr_n}\in U_y.$
(4) Putting $\,\Omega:=\{u_i,\ldots,u_k,ys_1,\ldots,ys_m\}\,$, derive the contradiction $\,U=\langle\Omega\rangle$.
A: I don't know how excited you might be about deeper results along these lines, and the question is completely answered already, but I can't resist mentioning some deeper results.
It turns out there are a lot of results of "maximal-implies-prime" flavor (like "ideal maximal among non-principal ideals", "ideal maximal among non-countably generated", "maximal among point annihilators of a module", "ideal maximal among ideals disjoint from a multiplicative set").
For a long time, these were proven on an ad hoc basis, but Lam and Reyes managed to get them all (and apparently new ones!) in one fell swoop. In another paper their approach is used to generalize some classical results of Kaplansky and Cohen about properties of prime ideals propagating to all ideals. 
They are really fantastic papers, that I think anyone would enjoy. Here are several related papers by Reyes at arXiv:
A prime ideal principle for two-sided ideals
Noncommutative generalizations of theorems of Cohen and Kaplansky
A one-sided Prime Ideal Principle for noncommutative rings
Enjoy!
