On prime ideals in a polynomial ring over a PID (from Reid's _Commutative Algebra_) More general version of this is in Reid's undergraduate commutative algebra. Prime ideals of $B[Y]$ where $B$ is a PID are as follows: $0$, $(f)$ for irreducible $f \in B[Y]$, and maximal ideals $m$.
I understood all the step except the last one. If $P$ is a prime ideal of $B[Y]$ then $B \cap P$ is a prime ideal of $B$. We have seen in steps 1-2(in textbook) that if $P$ is not principal then $B \cap P \neq 0$. Now $B$ is a PID, so that any nonzero prime ideal is maximal. So $P$ is maximal.
Why does $B \cap P$ maximal implies $P$ maximal? Is it true for any ring $A$ and $P$ prime in $A[x]$ that $P \cap A$ maximal implies $P$ is maximal?
 A: This is discussed in $\S 15.7$ of my commutative algebra notes.  (As I say, the discussion is taken directly from Reid's book.)
The key here is the Correspondence Theorem for ideals in a quotient ring.  The ideal $\mathcal{P}$ of $B[t]$ pulls back to $\mathfrak{p} = \mathcal{P} \cap B$, and it sounds like you are okay with the argument that $\mathfrak{p}$ is a maximal ideal in the PID $B$.  Thus by correspondence we may view $\mathcal{P}$ as an ideal in the quotient ring $B[t]/\mathfrak{p} B[t] \cong (B/\mathfrak{p})[t]$.  Since $\mathfrak{p}$ is maximal, $B/\mathfrak{p}$ is a field, and thus $S := (B/\mathfrak{p})[t]$ is a polynomial ring in one variable over a field, so again a PID.  The prime ideal $\mathcal{P}$ was constructed to properly contain $\mathfrak{p}$, so it corresponds to a nonzero prime ideal in the PID $S$...so it is maximal.  Under the Correspondence between ideals of $R/I$ and ideals of $R$ containing $I$, maximal ideals correspond to maximal ideals, and thus $\mathcal{P}$ is itself a maximal ideal of $B[t]$.
To answer your second question: no way is that true in general.  Suppose for instance that $A$ is a field and $\mathcal{P} = 0 \subset A[t]$.  This is a nonmaximal ideal of $A[t]$ which pulls back to a maximal ideal of $A$.  Going the other way around is more promising: if $A$ is a Jacobson ring then any maximal ideal of $A[t]$ pulls back to a maximal ideal of $A$ (see $\S 12$ of my notes for this material).  A PID which is not a field is a Jacobson ring iff it has infinitely many primes, so both cases are possible here.  Note that the Exercise at the end of $\S 15.7$ in my notes is addressing the dichotomy between Jacobson and non-Jacobson PIDs.
