Let $k$ be a commutative ring, $R$ and $S$ commutative $k$-algebras. Let $L$ and $M$ be $R$-modules. Consider the natural map $$\operatorname{Hom}_R(L,M)\otimes_k S \to \operatorname{Hom}_{R \otimes_k S}(L\otimes_k S, M \otimes_k S).$$

In what generality is this map an isomorphism?

Note: This question is reposted from math.SE. The partial answer here appears to show that it suffices to assume $S$ is free as a $k$-module, and either $S$ is finite over $k$ or $L$ is finitely generated as an $R$-module. It also seems to state that if $S$ is free but not finite over $k$, and $L$ is free but not finite over $R$, and $M$ is "reasonable" (e.g., $M=R$), then the morphism fails to be an isomorphism. But it is unsatisfying that the entire analysis (for providing both counterexamples and hypotheses) relies on the assumption that $S$ is free over $k$.

**Edit:** The following reduction is suggested by a-fortiori: the term on the left is equal to $$\operatorname{Hom}_R(L,M) \otimes_R (R \otimes_k S),$$ and the term on the right is equal to $$\operatorname{Hom}_{R \otimes_k S}(L \otimes_R (R \otimes_k S), M \otimes_R (R \otimes_k S)).$$ Thus, writing $T = R \otimes_k S$, we find that the morphism in question is $$\operatorname{Hom}_R(L, M) \otimes_R T \to \operatorname{Hom}_T(L \otimes_R T, M \otimes_R T).$$ Replacing $T$ by $S$, we see that we have reduced the original question to the case $k = R$, and consequently, $S = R \otimes_k S$. (I found a-fortiori's explanation overly succinct, but I think I've overcompensated.)