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: Note that the RHS can be written $\text{Hom}_R(M, S)$. More generally, we might ask when we have
$$\text{Hom}_R(M, N) \otimes_R S \cong \text{Hom}_R(M, N \otimes_R S).$$
for three $R$-modules $M, N, S$. (Special cases of this general question occur frequently here and on MO: see, for example, here, here, and here.) The answer is no in general but yes if any of the following conditions holds.


*

*$M$ is finitely presented and $S$ is flat.

*$S$ is finitely presented and $M$ is projective.

*$M$ is finitely presented projective.

*$S$ is finitely presented projective. 


A simple counterexample to the desired statement at the maximum level of generality is given by $R = \mathbb{Z}, M = S = \mathbb{Q}$. Note that here neither $M$ nor $S$ are finitely presented, and that $M$ is torsion-free. 
A: 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.
