A variation on Ishai's example is a closed embedding: its sheaf of relative differentials is 0
$0$, hence free of finite rank, even though it needn't be smooth.
However, k[e] / e^2
$k[e] / e^2$ over k
$k$ is not actually a counterexample (except in characteristic 2
$2$). The module of relative differentials of Spec k[e] / e^2
$\operatorname{Spec} k[e] / e^2$ over Spec k
$\operatorname{Spec} k$ is not free if the characteristic of k
$k$ is not 2$2$. Let A = k[e]
$A = k[e]$ and B = k[e] / e^2
$B = k[e] / e^2$. Then
Omega_B = Omega_A (x) B / d(e^2) = k[e] / (e^2, 2e)
$$\Omega_B = \Omega_A (x) B / d(e^2) = k[e] / (e^2, 2e)$$
via the isomorphism Omega_A --> A : dt --> 1
$\Omega_A \to A : dt \to 1$. This is not isomorphic to B
$B$ unless 2 = 0
$2 = 0$.
On the other hand, you can conclude that B
$B$ is smooth if its cotangent complex is a vector bundle in degree 0$0$. In the case of k[e] / e^2
$k[e] / e^2$, the cotangent complex is
[ I_{B/A} / I_{B/A}^2 ---> Omega_A (x) B ] = [ e^2 A / e^4 A ---> B de ]
$$ [ I_{B/A} / I_{B/A}^2 \to \Omega_A (x) B ] = [ e^2 A / e^4 A \to B\ de ] $$
in degrees [-1,0]
$[-1,0]$ and the differential is the universal derivation. (I write I_{B/A}
$I_{B/A}$ for the ideal of B
$B$ in A
$A$.) Even in characteristic 2
$2$, the differential has a kernel, so the cotangent complex is not concentrated in degree 0
$0$.