Let $R$ be a ring, not necessarily with identity, not necessarily commutative.

An ideal $\mathfrak{P}$ of $R$ is said to be a **prime ideal** if and only if $\mathfrak{P}\neq R$, and whenever $\mathfrak{A}$ and $\mathfrak{B}$ are ideals of $R$, then $\mathfrak{AB}\subseteq \mathfrak{P}$ implies $\mathfrak{A}\subseteq \mathfrak{P}$ or $\mathfrak{B}\subseteq \mathfrak{P}$.

(The condition given by elements, $ab\in P$ implies $a\in P$ or $b\in P$, is *stronger* in the case of noncommutative rings, as evidence by the zero ideal in the ring $M_2(F)$, with $F$ a field, but is equivalent to the ideal-wise definition in the case of commutative rings; this condition is called "strongly prime" or "totally prime". Generally, with noncommutative rings, "ideal-wise" versions of multiplicative ideal properties are weaker than "element-wise" versions, and the two versions are equivalent in commutative rings).

When the ring does not have an identity, you may not even have maximal ideals. But here is what you can rescue; recall that if $R$ is a ring, then $R^2$ is the ideal of $R$ given by all finite sums of elements of the form $ab$ with $a,b\in R$ (that is, it is the usual ideal-theoretic product of $R$ with itself, viewed as ideals). When $R$ has an identity, $R^2=R$; but even when $R$ does not have an identity, it is possible for $R^2$ to equal $R$.

**Theorem.** *Let $R$ be a ring, not necessarily with identity, not necessarily commutative. If $R^2=R$, then every maximal ideal of $R$ is also a prime ideal. If $R^2\neq R$, then any ideal that contains $R^2$ is not a prime ideal. In particular, if $R^2\neq R$ and there is a maximal ideal containing $R^2$, this ideal is maximal but not prime.*

*Proof.* Suppose that $R^2=R$. Let $\mathfrak{M}$ be a maximal ideal of $R$; by assumption, we know that $\mathfrak{M}\neq R$. Now assume that $\mathfrak{A},\mathfrak{B}$ are two ideals such that $\mathfrak{A}\not\subseteq \mathfrak{M}$ and $\mathfrak{B}\not\subseteq\mathfrak{M}$. We will prove that $\mathfrak{AB}$ is not contained in $\mathfrak{M}$ (we are proving $\mathfrak{M}$ is prime by contrapositive). Then by the maximality of $\mathfrak{M}$, it follows that $\mathfrak{M}+\mathfrak{A}=\mathfrak{M}+\mathfrak{B}=R$.

Then we have:
$$\begin{align*}
R &= R^2\\
&= (\mathfrak{M}+\mathfrak{A})(\mathfrak{M}+\mathfrak{B})\\
&= \mathfrak{M}^2 + \mathfrak{AM}+\mathfrak{MB}+\mathfrak{AB}\\
&\subseteq \mathfrak{M}+\mathfrak{M}+\mathfrak{M}+\mathfrak{AB}\\
&=\mathfrak{M}+\mathfrak{AB}\\
&\subseteq R,
\end{align*}$$
hence $\mathfrak{M}\subsetneq\mathfrak{M}+\mathfrak{AB}=R$. Therefore, $\mathfrak{AB}\not\subseteq\mathfrak{M}$. Thus, $\mathfrak{M}$ is a prime ideal, as claimed.

Now suppose that $R^2\neq R$ and $\mathfrak{I}$ is an ideal of $R$ that contains $R^2$. If $\mathfrak{I}=R$, then $\mathfrak{I}$ is not prime. If $\mathfrak{I}\neq R$, then $RR\subseteq \mathfrak{I}$, but $R\not\subseteq \mathfrak{I}$, so $\mathfrak{I}$ is not prime. In particular, if $\mathfrak{M}$ is a maximal ideal containing $R^2$, then $\mathfrak{M}$ is not prime. $\Box$

In your example, we have $R=2\mathbb{Z}$, $R^2=4\mathbb{Z}\neq R$, so any ideal that contains $R^2$ (in particular, the ideal $R^2$ itself) is not prime. And since $4\mathbb{Z}$ is a maximal ideal containing $R^2$, exhibiting a maximal ideal that is not prime. (In fact, $2\mathbb{Z}$ has maximal ideals containing any given ideals; this can be proven directly, or invoking the fact that it is noetherian)