Existence of such an example follows from the same result of Asanuma that is crucial for Gupta's work, see the article Teruo Asanuma, "Polynomial fibre rings of algebras over noetherian rings", Inventiones mathematicae 87 (1987), 101–127 (https://link.springer.com/article/10.1007%2FBF01389155). It follows from Corollary 5.3 of that article that if $$ A=\mathbb{Z}[x,y,z]/(-x^{p^e}+y+y^{sp}+pz), $$ where $p$ is a prime number and $e,s$ are positive integers such that $p^e\not\mid sp$, $sp\not\mid p^e$, then $A$ is not isomorphic to a polynomial ring, but $B=A[t]$ is isomorphic to a polynomial ring in three variables. Of course, $A$ is a retract of $B$ via the evaluation at $t=0$.