The big hire companies buy them at a very substantial discount off list prices, they get the 20% VAT straight back so the cars actually stand them a lot less value than list price on their accounts.
They are usually required to retain vehicles for a minimum of 6 months. They then aim to sell them for what the vehicle stands them, plus VAT. If they've bought well, sometimes they'll turn a profit.
It's suits the manufacturers because they can offload stock - production is not infinitely variable in the short term because as one example you've got engine plants geared up to produce certain numbers of engines and they don't have space to hold stock so it's cheaper to move them to the factories, put them in a car and sell it to a rental fleet at a discount.
There's not as much excess production these days as there was 10 - 15 years ago when the volume manufacturers would work out how many cars a factory could build and then run at capacity and worry about selling them later. I've noticed rental companies are keeping cars longer than they used to which probably reflects the reduced supply.