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?

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. 
