Let $A$ be a Noetherian domain and $B$ a finite $A$-algebra containing $A$ as a subring. Suppose there is a number $n$ such that for every maximal ideal $\mathfrak{m}$ of $A$, $\dim_{k(\mathfrak{m})} B \mathbin{\otimes_A} k(\mathfrak{m}) = n$ where $k(\mathfrak{m}) = A / \mathfrak{m}$. Why is $B$ flat in this case?
It's generally true that a finitely-generated module over a Noetherian ring is flat if and only if it is locally free (in the sense of the stalks being free), and if a finitely-generated module $M$ over a Noetherian domain $A$ is locally free, then its has constant local rank, in the sense that there is a number $n$ such that for all $\mathfrak{p} \in \operatorname{Spec} A$, $\dim_{k(\mathfrak{p})} M \mathbin{\otimes_A} k(\mathfrak{p}) = n$ where $k(\mathfrak{p}) = A_\mathfrak{p} / \mathfrak{p} A_\mathfrak{p}$. The converse is true if $A$ is reduced. (See, for example, Hartshorne [Algebraic Geometry, Ch. II, Exercise 5.8]) If we strengthen our hypotheses and demand that $A$ be a Noetherian Jacobson domain (or, at least, a Noetherian domain with trivial Jacobson radical), it is sufficient to assume that only the stalks over maximal ideals have dimension $n$ to prove that $M$ is locally free. But as far as I know Noetherian domains may have non-trivial Jacobson radical, e.g. Noetherian local rings. Am I supposed to use the hypothesis that $A$ is a subring of $B$ to prove the claim?