In todays time, its to keep customers from leaving bad reviews online. Example:
"I bought a used Pontiac at Big Jakes Auto and bigolly, I only put 300 miles on it and the check engine light told me I needed an oil change already".
Many dealers also give some sort of limited warranty on many, but not all vehicles they sell. They cant trust what the previous customer did to the vehicle.
If you already have a garage anyways, the oil & filter is cheap as are the grease monkeys hourly wage.
It's also a selling point that the vehicle has been checked, serviced and is good to go.