I am not an insider but most hotels I know charge extra for three people in a room, some also charge extra for single occupancy. One exception that comes to mind are no-frills hotels in Europe that specifically advertise with rooms for up to three people at the same price, e.g. Première Classe. Hotels probably do it simply because they can, either out of habit or because someone figured that they make more money that way. Needing an extra roll-away bed isn't even the most important factor.
Consider this: There are dozens of different prices for the same seat in the same plane. Train or bus pricing is still not as sophisticated but can also vary quite a lot. And the same room in the same hotel will also be cheaper at some times of the year or could be offered at other prices through different channels. Twenty years ago there would be a kilometer charge for trains, one or two prices for hotel stays (e.g. high and low season), all printed in guidebooks and elsewhere, plus some “hidden” prices (e.g. for tour operators who would book and pay in advance and carry the risk of selling the room or not). Nowadays, the web allows a lot more flexibility and you will find different prices depending on how full the hotel really is, whether you can cancel or change your booking, etc.
The basic fact is that whether you get the same service or whether it costs the same to the provider is simply not relevant to pricing, at least as long as they have some way to practice price discrimination without antagonizing the customer too much. Just saying “for you, it will cost double” depending on how a person looks is difficult (it does work that way on markets in some countries!) but an extra charge for an extra guest won't feel like a very bad deal and is easy to communicate and apply. I suspect there is no other reason behind this.
Note that it often works the other way around as well. The lowest rate on a particular flight might very well be under the average per-passenger cost. Economically, it's the cost of an additional passenger (the “marginal” cost) that matters and when most of the costs are fixed, it can be very low. Once you have a plane flying from A to B or a hotel staffed and warmed-up, you need to fill it at the highest possible total price, cost per unit is not relevant anymore.
Also, using an extra bed does cost something, even if the bed is always there in the first place. You have to factor in laundry, some more cleaning, extra towels and other amenities.