On the other hand, dealers usually include a warranty of some kind with their “certified pre-owned” vehicles. And as repeat players, they have a reputation to keep. The manufacturer also imposes further rules on them to protect the car brand.
Fwiw, I strongly oppose laws that protect the dealership business. But this specific thing you’ve noticed is not some grand conspiracy (how would that work anyway?). It’s just rational consumer behavior.