In what generality is the natural map $\operatorname{Hom}_R(L,M)\otimes S\to\operatorname{Hom}_{R\otimes S}(L\otimes S,M\otimes S)$ an isomorphism? 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.)
 A: Here is just some sanity check: 
We may as well work on the local case. Suppose $R=k$ local and $S=R/m$, $m$ is the maximal ideal of $R$. I will also assume $L,M$ finitely generated. Then the LHS is $S^{\mu(Hom_R(L,M))}$ while the RHS is $S^{\mu(L)\mu(M)}$. So if your map is an isomorphism, one must have:
$${\mu(Hom_R(L,M))} = {\mu(L)\mu(M)} \ \ \ (*)$$
Here $\mu(L)$ is the number of generators of $L$. This rarely happens unless $L$ is free. If $L$ is not, even freeness of $M$ is not enough. For example, if $M=R$ and $ann_R(L)$ contains   a non-zerodivisor on $R$ (e.g, if $R$ is a domain and $L$ any torsion module), then the LHS of $(*)$ is $0$, while the RHS is $\mu(L)$. 
In summary, together with the comments: if $R\otimes_kS$ is not flat over $R$, then I think $L$ must be projective for this to be true in any reasonable generality. May be your situation is more specific, if so  can you tell us what you want to be true ?  
EDIT: in fact, the above analysis suggests the following class of counter examples: Let $k=R$, $L = R/(x)$ where $x$ is $R$-regular and $M=R$. Then the LHS of your original map  is $0$, while the RHS is $Hom_S(S/(x), S) \cong 0:_{S} x$. If $x$ is not $S$-regular then the RHS is not $0$. 
