4. $B$ is the intersection point of the ellipse $\frac{x^{2}}{a^{2}}+\frac{y^{2}}{b^{2}}=1(a>b>0)$ with the positive $y$-axis, and point $P$ moves on the ellipse. Then the maximum value of $|B P|$ is ( ).
(A) $2 b$
(B) $\frac{a^{2}}{c}$
(C) $2 b$ or $\frac{b^{2}}{c}$
(D) $2 b$ or $\frac{a^{2}}{c}$
4.D.

Let $P(a \cos \alpha, b \sin \alpha)$. Since $B(0, b)$, we have
$$
\begin{array}{l}
|B P|^{2}=a^{2} \cos ^{2} \alpha+(b \sin \alpha-b)^{2} \\
=\left(b^{2}-a^{2}\right)\left(\sin \alpha-\frac{b^{2}}{b^{2}-a^{2}}\right)^{2}+\frac{a^{4}}{c^{2}} .
\end{array}
$$

When $\left|\frac{b^{2}}{b^{2}-a^{2}}\right| \leqslant 1$, i.e., $a \geqslant \sqrt{2} b$, $|\dot{B P}|_{\max }=\frac{a^{2}}{c}$.
At this time, $\sin \alpha=\frac{b^{2}}{b^{2}-a^{2}}, P\left(\frac{a^{2} \sqrt{a^{2}-2 b^{2}}}{ \pm\left(b^{2}-a^{2}\right)}, \frac{b^{3}}{b^{2}-a^{2}}\right)$;
When $\left|\frac{b^{2}}{b^{2}-a^{2}}\right|>1$, i.e., $b<a<\sqrt{2} b$, $|B P|_{\max }=2b$. At this time, $\sin \alpha=-1, P(0,-b)$.