Many Web sites and articles warn against buying former rental cars, because people renting these cars often mistreat them.
Many of those are also written by unqualified individuals for publication on blog farms and encourage all sorts of odious financial practices. That's not even considering the interests of who is paying to advertise on said blogs-- I'm sure their interests align with making sure you always pay top dollar for a new car. Because those icky used ones are so mistreated!
Never trust financial advice published on the internet (or in the media, for that matter).
Edit: One caveat on further thought-- never, never buy used vehicles from government auctions (impounds, asset seizures, old police cars, etc). Anybody irresponsible enough to go to jail or abandon their car long enough to lose their assets likely isn't a responsible owner of such, and cops and crooks alike do absolutely beat the snot out of police cars.
When it comes to government-owned vehicles (police cars, schoolbuses) municipal governments are notoriously stingy and will squeeze every last minute of use out of them before putting them on the market. If you're buying a government vehicle, assume it's being sold because it has intractable problems.
But from a financial point of view, I notice that rental agencies sell cars within the first two years, during the time when they depreciate the most.
I figure many large rental companies will have mathematicians who calculate the best time to sell. Does the fact that they sell the car mean during this time suggest that they know the car's cost of further maintenance or other costs will be higher? Or is there another reason they sell at this time which, has a calculated advantage to them, but which is less than idea statistically for me, the purchaser?
It doesn't take a PhD to realize it's bad for business if your model revolves around renting out 1970s rustbuckets that run the risk of breaking down and leaving customers stranded in inopportune or dangerous places. Uhaul in particular has a terrible reputation for this, and it shows in the condition of their trucks-- relics of the 90s, all of them. Uber won't let you drive for them if your car is older than 7-10 years for the same reasons.
Yes, as a car ages, the chance of having to make repairs increases. Rental agencies are in the business of renting vehicles, not running service centers and garages. It's more aligned with their core business model to just dispose of cars once they've squeezed the most reliable years out of them and amortize the vehicles' depreciation across the tax deductions and fleet pricing they enjoy when buying new ones.
This gets them out of the service game and lets them focus on their core business-- procurement and rental. There's no calculated "time-to-lemon" that they're trying to skirt here; they're just trying to avoid having to make any repairs whatsoever.