Let P be a maximal, infinitely generated ideal in a commutative ring R. Remember that the entire ring is generated by 1, so an infinitely generated ideal is always proper; P is proper. We want to show P is prime.
Suppose xy is in P, but x and y are not. Now P+Rx and P+Ry properly contain P, and are finitely generated. Let the generators of P+Ry be ui+vi*y, where u comes from P and v comes from R.
Let J be the ideal formed by the elements of R that, when multiplied by y, lie in P. Since 1*y does not lie in P, J is a proper ideal. Now J contains P, and x, and is finitely generated. Let W be a set of generators for J.
Let t be any element in P, hence in P+Ry, hence equal to some linear combination of the generators ui+vi*y. The linear combination of ui, and t, lie in P, hence that particular linear combination of vi*y also lies in P. Since y is driven into P, our linear combination of vi is an element in J, and can be produced by a linear combination of the generators in W.
Let G be the generators in u, along with y times the generators in W. Now G is able to span t, and since t was arbitrary, G spans all of P. Since all the generators in G lie in P, P is finitely generated, which is a contradiction. Therefore P is prime.
A similar proof shows that a maximal ideal in the set of nonprincipal ideals is also prime. Again, R is generated by 1, so we know our maximal ideal P is proper. Assume xy lies in P, while x and y do not.
Let d generate P+Ry, which is principal. Let J be the ideal that drives y into P. Let c generate J, which is principal. Given t in P, let t = ud. Now u maps d into P; u maps all of P+Ry into P; u maps y into P; hence u is in J. Write u = vc. Now t = vcd. Since t was arbitrary, cd spans P. Since c drives y, and hence P+Ry, into P, cd is in P, making P a principal ideal, which is a contradiction.