I think what you want is exactly that the dominion (in the sense of Isbell) of $B$ in $A$ be equal to $B$.
Recall that if you are in a category of algebras (in the sense of Universal Algebra), and $B\subseteq A$ is a subalgebra of $A$, then the dominion of $B$ in $A$ (relative to the category of context) is the set $$\{a\in A\mid \forall C\forall f,g\colon A\to C (f|_B=g|_B\implies f(a)=g(a))\}.$$
If $x$ lies in the dominion of $B$ in $A$, then the fact that the two embeddings of $A$ into $A\otimes A\otimes_B A$ agree on $B$ implies that they agree on $x$; that is, $x\otimes 1=1\otimes x$. Conversely, suppose that the two embeddings of $A$ into $A\otimes A\otimes_B A$ agree on $x$; if $C$ is any commutative ring and $f,g\colon A\to C$ are two maps that agree on $B$, then the universal property of $A\otimes_B A$ guarantees a homomorphism $\Phi\colon A\otimes A\otimes_B A\to C$ such that $f = \Phi\circ\lambda$ and $g=\Phi\circ\rho$, where $\lambda$ and $\rho$ are the left and right embeddings; then since $\lambda(x)=\rho(x)$, we conclude that $f(x)=g(x)$. Hence any element of the equalizer is in th dominion.
A characterization of dominions in the category of commutative rings is given in the Isbell-Mazet-Silver Zigzag Theorem: the dominion of $B$ in $A$ consists precisely of the elements of $A$ that can be written in the form $XYZ$, where $X$ is a row matrix, $Z$ is a column matrix, $Y$ is a square matrix of the appropriate size, all $X$, $Y$, and $Z$ have entries in $A$, and $XY$ and $YZ$ have entries in $B$.
(See also this previous post.)
So the inclusion of $B$ is the equalizer of the left and right embeddings if and only if $B$ is equal to its own dominion in $A$.
(Certainly, if Essentially, when the category is right-closed, the dominion of $B$ is not dominion-closed in $A$, then A$ is always equal to the equalizer of the two embeddings $A\to A\amalg_{B}A$; in the category of commutative rings the tensor product functions as a binary coproduct, hence the dominion of $B$ in $A$ is not the equalizer of the two embeddings $A\to A\otimes_B A$; I guess I'm but this description does not actually answer your question, it just asks it in a little wary of different language; so the converse...actual answer you want is contained in the Isbell-Mazet-Silver Zigzag Theorem, when all is said and done.)

