Dual Commutes with Base Change Let $R$ be a ring, and let $S$ be an $R$-algebra. Let $M$ be an $R$-module. Under what conditions on $R$, $S,$ and $M$ is it true that we have the following isomorphism of $S$-modules?
$$S \otimes_R \operatorname{Hom}_R(M, R) \simeq \operatorname{Hom}_S(S \otimes_R M, S)$$
I know there is an obvious map from the left-hand side above to the right-hand side (namely, send a map $\phi \colon M \to R$ to the map $\operatorname{id} \otimes_R\, \phi$), but I do not know what conditions are required for there to be an inverse map. Does this have anything to do with $M$ being torsion-free as an $R$-module?

a) Your morphism $f:S \otimes_R \operatorname{Hom}_R(M, R) \to \operatorname{Hom}_S(S \otimes_R M, S)$ is in general not bijective, as shown by the example ($R=\mathbb Z,S=\mathbb Z/2,M=\mathbb Z/2)$ $$\mathbb Z/2 \otimes_\mathbb Z \operatorname{Hom}_\mathbb Z(\mathbb Z/2,\mathbb Z  )=0 \to \operatorname{Hom}_{\mathbb Z/2}(\mathbb Z/2 \otimes_\mathbb Z \mathbb Z/2, \mathbb Z/2)=\mathbb Z/2$$    
b) Your morphism  is an isomorphism whenever at least one of the two modules $A$-modules $B$ or $M$ is projective of finite type: Bourbaki, Algebra, Chapter II, §5.4, Prop.8, page 283.
