Does the law say you can't do upfront pricing? Surely the company could just eat the difference in the situation you raise? To me this seems to be Uber's way of passing on any extra cost and risk to customers rather than risk any of their own skin.
The law prohibits upfront pricing unless the drivers are employees of uber.
The law requires you (the rider) to be the customer of the driver. So the pricing / payment between driver and rider need to be linked.
If you are a customer of uber transit services (instead of uber ride finding and safety platform) they can offer flat rate prices and eat difference, but the drivers then need to be employees.