Our dog always threw up on the carpet, never on the floor. Obviously, this way it's way harder to clean up the mess.
We always thought it was a traction thing.
When you throw up, it takes a lot out of you/your body to do so and to keep somewhat still. With dogs, they don't have a ton of grip on smooth floors and they'd probably slip in the middle of throwing up.
We've mostly trained him to vomit over where the carpet changes to tile. He still gets traction from the carpet but we get easy clean up.
When he was a puppy, we would hear him doing his little hurk he did before he threw up so we would rush to find him, pick him up and set him on the tile. He always moved his feet back on the carpet and sometimes we had to point his head the right direction but he picked up on what we wanted pretty quickly. Now when he throws up he tries really hard to get his head over the tile floor if he can make it.
Occasionally we'll find some on the carpet if he couldn't make it but that's usually an indicator that he's not feeling well.