The following is the very first exercise from Assem, Simson and Skowronski's text Elements of the Representation Theory of Associative Algebras 1.
Exercise. Let $f:A\to B$ be a homomorphism of $k$-algebras. Prove that $f(\mathrm{rad\,} A)\subseteq \mathrm{rad}\,B$.
Why is the following not a counterexample? Take any local, integral $k$-algebra $A$ (for instance $k[[x]]$) and consider the injection into its field of fractions $B$. Obviously this mapping is injective, but $B$ has trivial radical while $A$ does not.
Your counterexample is correct, and the exercise is just wrong.