I wonder if the miracle flatness theorem Generalizing miracle flatness (Matsumura 23.1) via finite Tor-dimension still works if the rings involved are not local (and the dimension condition is deleted)?

In other words, is it true that $f: A \to B$, $A$ regular, $B$ Cohen-Macaulay, implies that $f$ is flat? I guess the answer is no (maybe taking $A=k[x,y]$, $B=A/I$, with a right choice of an ideal $I$ of $A$ will serve as a counterexample? or maybe no).

But what if we further assume that: $f$ is injective, $A$ is Noetherian and $B$ is a finitely generated $A$-module? Is $f$ flat in this case?

I ask this question since I have seen here this claim as a fact https://math.stackexchange.com/questions/296971/what-has-projectiveness-to-do-with-cohen-macaulay-rings/297320#297320, with reference to EGA IV 6.1.5, though it seems (I do not know French) that Grothendieck talks about the local case.