[proofplan]
We must show that tensoring with $S \otimes_R M$ over $S$ preserves injectivity. Given an injective $S$-module map $g: N \to N'$, we reduce the problem to showing that $\operatorname{id}_M \otimes g: M \otimes_R N \to M \otimes_R N'$ is injective by using the canonical associativity isomorphism $(S \otimes_R M) \otimes_S N \cong M \otimes_R N$. Since $M$ is flat over $R$ and $g$ is injective as an $R$-module map, the bottom map is injective. The commutativity of the resulting diagram then forces the top map to be injective.
[/proofplan]
[step:Reduce to showing injectivity of $\operatorname{id}_M \otimes g$ over $R$ via the associativity isomorphism]
Let $g: N \to N'$ be an injective $S$-module homomorphism. We must show that
\begin{align*}
\operatorname{id}_{S \otimes_R M} \otimes_S g: (S \otimes_R M) \otimes_S N \to (S \otimes_R M) \otimes_S N'
\end{align*}
is injective. By the transitivity of extension of scalars, there are canonical $S$-module isomorphisms
\begin{align*}
\alpha_N: (S \otimes_R M) \otimes_S N &\xrightarrow{\;\sim\;} M \otimes_R N, \quad (s \otimes m) \otimes n \mapsto m \otimes (sn), \\
\alpha_{N'}: (S \otimes_R M) \otimes_S N' &\xrightarrow{\;\sim\;} M \otimes_R N', \quad (s \otimes m) \otimes n' \mapsto m \otimes (sn').
\end{align*}
These isomorphisms are well-defined because they arise from composing the standard associativity isomorphism $(S \otimes_R M) \otimes_S N \cong M \otimes_R (S \otimes_S N)$ with the canonical isomorphism $S \otimes_S N \cong N$ (given by $s \otimes n \mapsto sn$, using the $S$-module structure of $N$).
[guided]
To show $S \otimes_R M$ is flat as an $S$-module, we take an arbitrary injective $S$-module map $g: N \to N'$ and must show that
\begin{align*}
\operatorname{id}_{S \otimes_R M} \otimes_S g: (S \otimes_R M) \otimes_S N \to (S \otimes_R M) \otimes_S N'
\end{align*}
is injective. The key idea is to "reassociate" the tensor products so that the $S$-flatness question reduces to the known $R$-flatness of $M$.
We use the transitivity of extension of scalars: for any $S$-module $L$, there is a canonical $S$-module isomorphism $(S \otimes_R M) \otimes_S L \cong M \otimes_R L$. Concretely, this is the composite of the associativity isomorphism $(S \otimes_R M) \otimes_S L \cong M \otimes_R (S \otimes_S L)$ and the canonical isomorphism $S \otimes_S L \cong L$ given by $s \otimes l \mapsto sl$ (using that $L$ is an $S$-module). The result is:
\begin{align*}
\alpha_L: (S \otimes_R M) \otimes_S L &\xrightarrow{\;\sim\;} M \otimes_R L, \quad (s \otimes m) \otimes l \mapsto m \otimes (sl).
\end{align*}
Applying this with $L = N$ and $L = N'$ gives two isomorphisms $\alpha_N$ and $\alpha_{N'}$. These let us translate the $S$-tensor problem into an $R$-tensor problem where we can exploit the flatness of $M$.
[/guided]
[/step]
[step:Verify that the associativity isomorphisms form a commutative diagram with $g$]
We claim the following diagram commutes:
\begin{align*}
(S \otimes_R M) \otimes_S N &\xrightarrow{\;\operatorname{id}_{S \otimes_R M} \otimes_S g\;} (S \otimes_R M) \otimes_S N' \\
\downarrow\; \alpha_N &\qquad\qquad\qquad\qquad \downarrow\; \alpha_{N'} \\
M \otimes_R N &\xrightarrow{\;\operatorname{id}_M \otimes_R g\;} M \otimes_R N'
\end{align*}
To verify commutativity, we check on generators. For $(s \otimes m) \otimes n \in (S \otimes_R M) \otimes_S N$:
\begin{align*}
(\alpha_{N'} \circ (\operatorname{id}_{S \otimes_R M} \otimes_S g))((s \otimes m) \otimes n) &= \alpha_{N'}((s \otimes m) \otimes g(n)) = m \otimes (s \cdot g(n)) = m \otimes g(sn),
\end{align*}
where the last equality uses $S$-linearity of $g$. On the other hand:
\begin{align*}
((\operatorname{id}_M \otimes_R g) \circ \alpha_N)((s \otimes m) \otimes n) &= (\operatorname{id}_M \otimes_R g)(m \otimes sn) = m \otimes g(sn).
\end{align*}
The two expressions agree, so the diagram commutes.
[guided]
We need the associativity isomorphisms to intertwine the map $g$ correctly. That is, going "down then right" in the diagram must equal going "right then down." We verify on a generating element $(s \otimes m) \otimes n$:
**Right then down:** First apply $\operatorname{id}_{S \otimes_R M} \otimes_S g$ to get $(s \otimes m) \otimes g(n)$, then apply $\alpha_{N'}$ to get $m \otimes (s \cdot g(n))$. Since $g$ is an $S$-module homomorphism, $s \cdot g(n) = g(s \cdot n) = g(sn)$, so the result is $m \otimes g(sn)$.
**Down then right:** First apply $\alpha_N$ to get $m \otimes sn$, then apply $\operatorname{id}_M \otimes_R g$ to get $m \otimes g(sn)$.
Both paths give $m \otimes g(sn)$, confirming commutativity. Since the elementary tensors $(s \otimes m) \otimes n$ generate $(S \otimes_R M) \otimes_S N$ as an $R$-module, the two compositions agree on the entire module.
[/guided]
[/step]
[step:Conclude that the top map is injective using flatness of $M$ over $R$]
The map $g: N \to N'$ is injective as an $S$-module map, and in particular it is injective as an $R$-module map (via restriction of scalars along $f: R \to S$). Since $M$ is flat as an $R$-module, the map
\begin{align*}
\operatorname{id}_M \otimes_R g: M \otimes_R N \to M \otimes_R N'
\end{align*}
is injective. In the commutative diagram above, the bottom map is injective and both vertical maps $\alpha_N$, $\alpha_{N'}$ are isomorphisms (in particular, injective). For any $x \in \ker(\operatorname{id}_{S \otimes_R M} \otimes_S g)$, we have
\begin{align*}
(\operatorname{id}_M \otimes_R g)(\alpha_N(x)) = \alpha_{N'}((\operatorname{id}_{S \otimes_R M} \otimes_S g)(x)) = \alpha_{N'}(0) = 0.
\end{align*}
Since $\operatorname{id}_M \otimes_R g$ is injective, $\alpha_N(x) = 0$. Since $\alpha_N$ is an isomorphism, $x = 0$. Therefore $\operatorname{id}_{S \otimes_R M} \otimes_S g$ is injective, and since $g$ was an arbitrary injective $S$-module map, $S \otimes_R M$ is a flat $S$-module.
[guided]
Now we connect the pieces. The $R$-module map $g: N \to N'$ is injective (the $S$-module structure restricts to an $R$-module structure via $f$, and injectivity of a map depends only on its kernel, which is the same regardless of which scalar ring we view it over). Since $M$ is flat over $R$, the functor $M \otimes_R -$ preserves injections, so $\operatorname{id}_M \otimes_R g$ is injective.
In the commutative diagram, the vertical arrows are isomorphisms and the bottom arrow is injective. We claim the top arrow must also be injective. Indeed, suppose $x \in (S \otimes_R M) \otimes_S N$ lies in the kernel of $\operatorname{id}_{S \otimes_R M} \otimes_S g$. By commutativity:
\begin{align*}
(\operatorname{id}_M \otimes_R g)(\alpha_N(x)) = \alpha_{N'}((\operatorname{id}_{S \otimes_R M} \otimes_S g)(x)) = \alpha_{N'}(0) = 0.
\end{align*}
Injectivity of $\operatorname{id}_M \otimes_R g$ gives $\alpha_N(x) = 0$, and since $\alpha_N$ is an isomorphism, $x = 0$. So the top arrow is injective.
Since $g: N \to N'$ was an arbitrary injective $S$-module homomorphism, the functor $(S \otimes_R M) \otimes_S -$ preserves injections, which is exactly the definition of $S \otimes_R M$ being flat as an $S$-module.
[/guided]
[/step]