Let $A$ be a commutative ring with $1$, and $B\subseteq A$ be a subring.

Is there a simple condition on $B$ and $A$ guaranteeing that $B\to A\rightrightarrows A\otimes_B A$ is an equalizer?

In other words, when does $a\otimes_B 1 = 1\otimes_B a$ imply that $a\in B$?

This always holds, for example, if $B=K$ is a field and $A=L$ is a finite separable extension of $K$. For then, if $\ell\otimes 1 = 1\otimes \ell$ in $L\otimes_K L$, the same clearly holds in $\bar K\otimes_K L$, where $\bar K$ is a separable closure of $K$ containing $L$. But the $\bar K$-algebra homomorphism $\bar K\otimes_K L\to \bar K^{\mathrm{Hom}_K(L,\bar K)}$ sending $\alpha\otimes\ell\mapsto (\alpha\cdot s(\ell))_{s:L\to\bar K}$ is an isomorphism, and the equation becomes $\ell = s(\ell)$ for all $s:L\to \bar K$. But this means $\ell$ is fixed by the action of the absolute Galois group of $K$ (which acts transitively on the $s$), so $\ell\in K$.

Does the result hold for general $B$ and $A$? If not, is there a simple condition describing when it does hold? Or, failing that, is there a simpler proof in the case of a separable field extension, that doesn't need Galois theory?