Let $A \subseteq B$ be two $k$-algebras, $k$ is a field of characteristic zero. Assume that $\dim(A)=\dim(B) < \infty$.
Is it possible to find a non-maximal ideal $J$ of $B$ such that $J \cap A$ is a maximal ideal of $A$?
Please see this question, in which the following example appears: $A=k[x] \subset k[x,y]=B$. $J = (x,y^2)$ is not a maximal ideal of $k[x,y]$ and $J \cap k[x] = (x)$ is a maximal ideal of $k[x]$; but in this example we have $\dim(A)=1 < \dim(B)=2$.
Thank you very much!
When you don't require $J$ to be prime, things can get weird, even for integral extensions, as Youngsu pointed out (see $k[x^2] \subseteq k[x]$, where $x^2k[x] \cap k[x^2] = x^2k[x^2]$).
The important positive result that works even when $J$ is not prime is the following: if $A \subseteq B$ is an epimorphism of rings and $J$ is an ideal of $B$ such that $J \cap A = \mathfrak{m}$ is maximal, then $J$ is maximal.
Indeed, in this case the pushout $A/\mathfrak{m} \subseteq B/J$ is an epimorphism from a field, so it is a surjection. Thus $B/J$ is a field and $J$ is a maximal ideal [Stacks Lemma 10.106.7, 10.106.8]
Edit: flatness obviously has nothing to do with this property. Consider $k \subseteq k[x]$. Every ideal contained in $xk[x]$ contracts to $0$.
Edit again Also for any field $k$, the finite product $\prod k$ is separable over $k$, and there will be non-maximal ideals which contract to $0$ in $k$.