Why is RAM so expensive from hosting companies? [duplicate]
It's for a few reasons. But it's about mainly about value not cost.
Hosting companies are operating a business, as do most of their clients. The extra resources a client has the more gains they can achieve i.e. busier site -> extra visitors -> more customers -> more revenue. As such extra RAM isn't costed by it's pure physical price, it's costed by the extra value the RAM brings the client. (See: value added)
Also along the similar lines other people have mentioned (it more applies to VM/cloud servers but can be for dedicated too), that extra 16GB of RAM you want could otherwise be split into 8 other 2GB servers instead, which each bring in more revenue than your single box, even with extra RAM. That 2GB of RAM in a standard server will be far more cost-effective to the hosting provider than as extra RAM for you.
There is also the whole "customization" question - if you want something extra, but also expect it to be fixed when it goes wrong, the cost to the hosting provider is base cost x2 (i.e. keeping spares!). But having 16GB RAM sitting around "just in case" doesn't make them money - so they have to charge you for the privilege.
Basically I understand your question - it's one I've come across a few times when dealing with individuals (as opposed to companies) - but in the end, it's business.
The problem is that the server is shared. Most shared servers actually have cpu time to spare, so that's not a factor, and are connected to SAN storage already, so the disk I/O is easy to control as well. That leaves RAM and network capacity as the primary billing factors.
You can only stuff so much ram in a box. If you want a lot of RAM, they can't have as many servers running on that box or they have to put your server in a more-expensive form factor; it drives up their costs per server. Of course, if you're willing to cover those costs they're happy to sell it to you.
Put another way, if the hoster normally uses racks full of 1U pizza box servers stuffed full of 16GB RAM each, and the standard configuration is 1GB of RAM, their expecting to host 16 clients on each server. If you want 16GB, you have to buy the whole server.