Let $f:A\to B$ be a ring homomorphism and $S$ be a multiplicative set, define $S^{-1}B$ to be $B\times S$ with equivalence relation $(b,s)\sim(b',s')$ iff $\exists t\in S$ such that $t(sb'-s'b) = 0$. Then $S^{-1}B$ has an $S^{-1}A$-algebra structure, which turns out to be isomorphic to $S^{-1}A\otimes_A B$.
Alternatively, the map $f$ induces a ring homomorphism $f:S^{-1}A\to f(S)^{-1}B$, which gives $f(S)^{-1}B$ an $S^{-1}A$-algebra.
Then a question is whether $S^{-1}B$ and $f(S)^{-1}B$ are isomorphic as algebras? My feeling is that they are not unless $f$ is injective, is it true? Which one of them is more 'natural' to consider?
$S^{-1}B$ and $f(S)^{-1} B$ are in fact isomorphic, simply because the action of $A$ on $B$ is defined via $f: A \rightarrow B$. To see this explicitly, note that when you gave the definition of $S^{-1}B$, you defined $(b,s)$ ~ $(b',s')$ if there exists $t \in S$ such that $t (s b' - s' b)=0$. But what does $s b'$ mean? What is the action of $s$ on $B$? This is defined as $s b' := f(s) b'$. Similarly $s' b := f(s') b$ and finally $t (s b' - s' b):=f(t) (f(s) b' - f(s') b)=0$. But this latter is the definition of equivalence of $(f(s),b)$ and $(f(s'),b')$ in $f(S)^{-1} B$.