Let $f=f(T) \in \mathbb{C}[x,y][T]$ be a monic polynomial: $f=T^n+a_{n-1}T^{n-1}+\cdots+a_1T+a_0$, $a_j \in \mathbb{C}[x,y]$.

Denote: $A=\mathbb{C}[x,y]$ and $B=\mathbb{C}[x,y,T]/(f)=\mathbb{C}[x,y][w]$, where $w^n+a_{n-1}w^{n-1}+\cdots+a_1w+a_0=0$.

Of course, $A$ is a UFD, so irreducible elements of $A$= prime elements of $A$.

Can one describe all possible forms of $f$, for which every irreducible element of $A$ remains irreducible in $B$?

The motivation to ask this question is $k[x^2] \subset k[x^2][x^3]$; it seems that every irreducible element of $k[x^2]$ remains irreducible (but not prime) in $k[x^2][x^3]=k[x^2,T]/(T^2-(x^2)^3)$.

**Remarks:**
(1) Notice that $a_0$ is reducible in $B$.

(2) I assumed that $f$ is monic in order to obtain that $A \subset B$ is flat, according to Nagata's theorem, Theorem D.2.2 ($e=1$). Actually, $A \subset B$ is free.

(3) A plausible answer can be found in Lemma 3.2 which says the following: Let $A$ be a UFD. Let $R \subseteq A$ be a subring of $A$ such that $R^* = A^*$. The following conditions are equivalent: (i) Every irreducible element of $R$ remains irreducible in $A$. (ii) $R$ is factorially closed in $A$, namely, if $x,y \in A$ satisfy $xy \in R - {0}$, then $x,y \in R$; however, in my question, the smaller ring is a UFD, while in Lemma 3.2 the larger ring is a UFD.

I guess that my question has no complete answer, so partial answers are also welcome. Thank you very much!