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 ([DOI link](https://doi.org/10.1007/BF01389155)). 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$. EDIT: Moreover, consider $$ A_n:=\mathbb{Z}[x,y,z,x_1,\ldots,x_n]/(-x^{p^e}+y+y^{sp}+px_1\cdots x_nz), $$ then the proof of the same Corollary 5.3 (in the case $R=\mathbb{Z}[x_1,\ldots,x_n]$) can be adapted to show that $A_n[t]$ is isomorphic to the polynomial ring in $n+3$ variables, but $A_n$ is not isomorphic to the polynomial ring in $n+2$ variables.