A more general series of examples (when this fails) is given by choosing $B$ to be Cohen-Macaulay, but not Gorenstein and $A$ to be Gorenstein.
An explicit example is when $B=(k[x,y,z]/(xy,yz,zx)_{\mathfrak B=(k[x,y,z]/(xy,yz,zx))_{\mathfrak m}$ is the affine coordinate ring of three lines in $\mathbb A^3$ meeting in one point, but not contained in a plane and $A=k[x,y,z]_{\mathfrak m}$ where ${\mathfrak m}=(x,y,z)$.

