maximal ideal in local subrings Let $A,B$ be two local rings and put $\mathfrak{m}_A, \mathfrak{m}_B$ their maximal ideals. Now suppose that we have an injection $0 \to A \to B$ and put $\mathfrak{n} := A \cap \mathfrak{m}_B $. It seems to me quite obvious that it should be $\mathfrak{m}_A = \mathfrak{n}$ (at least in the geometric way of thinking local rings). The question is if someone knows an example in which $\mathfrak{m}_A \supset \mathfrak{n}$ and $\mathfrak{m}_A \neq \mathfrak{n}$ or a proof of the equality which goes well in this general algebraic setting without refering to geometry; I found this problem in solving Liu's exercise in Algebraic Geometry and there all goes well thanks to the geometric assumptions that these rings are local rings of ringed topological space and that the ring $A$ is the universal quotient of $B$ by a $G$-action. Then I try to generalize this part of the proof but I lost myself.
Thank you
 A: Daniel Litt is exactly right, it is not necessary in general.
However, in the setting of algebraic geometry you are fine.  Suppose now that $A$ and $B$ are obtained by localizing finitely generated $k$-algebras at a maximal ideal.  Then $B/{\mathfrak{m}}_B$ is a finite extension field of $k$ (if $k$ is algebraically closed, it is equal to $k$).
Now then, $A/\mathfrak{n} \to B/{\mathfrak{m}_B}$ is also an extension of rings and the left hand-side is also a domain.  But $k \subseteq A/\mathfrak{n} \subseteq B/{\mathfrak{m}_B}$ so $A/\mathfrak{n}$ if a finite extension of $k$.  So $A/\mathfrak{n}$ is a field.  So $\mathfrak{n}$ is maximal.  
I remember Sandor pointing this out to me in a first-year algebra course.
PS:  At first I thought that the ring map $A \to B$ being finite type maps might be enough, but Daniel Litt's example also shoots that down.
A: This question was posted a while ago, but I couldn't resist!
If you have a local homomorphism of local rings $(A,\mathfrak{m}_A)\stackrel{\varphi}{\longrightarrow}(B,\mathfrak{m}_B)$ (it doesn't have to be injective), then $\varphi^{-1}(\mathfrak{m}_B)=\mathfrak{m}_A$. No extra condition is needed. 
Local homomorphism means $\varphi(\mathfrak{m}_A)\subseteq\mathfrak{m}_B$. In the given example 
$$0\rightarrow\mathbb{Z}_{(p)}\rightarrow\mathbb{Q}$$ 
the problem is that the map is not a local homomorphism, that is, the maximal ideal of $\mathbb{Z}_{(p)}$ is not mapped inside the maximal ideal of $\mathbb{Q}$.
Commutative algebraist most of the time assume their maps are local maps.
