RAM and hard disks operate on entirely different principles.
Hard disks operate by having a single head that moves across a magnetized medium reading or writing to data from or to an area. As such access is slow, because the head has to move to where the data is before it can do meaningful work. The upside is that the actual medium storing data is entirely passive and does not need anything to keep data there.
RAM is entirely digital electronics, using active DRAM logic cells to hold data. These cells need to be refreshed and held to hold data or the voltage level of the cell will dissipate and the data will be lost. Because of their pure electronic nature there is no delay in switching areas of RAM like there is for disks. Every spot is immediately accessible but every memory area also needs to be permanently powered, unlike a hard disk.
As a result RAM requires a lot more power, byte for byte, than a hard disk does.
RAM also needs a lot of control logic and a direct wide address bus to access a whole lot of data. Hard disks just get told "store data x at location y" in a command and are left to their own devices as to how to accomplish the task.
NAND flash comes somewhat close to giving us the best of both worlds, but with the cost of limited write endurance. Every time you erase a NAND flash cell you are doing a tiny bit of damage to it.
From an actual data medium perspective a hard disk is simply a very fine magnetic coating on a spinning platter being pushed into one state of magnetism or another. While it must be precise and well made it is, relatively speaking, quite simple and easy to achieve.
RAM by contrast is a silicon chip (with associated logic) built up layer-by-layer using photolithographic techniques. RAM is painstakingly hard to manufacture and one tiny mistake or bit of debris can ruin an entire chip or batch. With many layers making up a huge memory array this is a very complex and delicate process to achieve acceptable yields of chips.
DRAM memory cells are also probably a lot larger than the physical storage area of a hard disk, due to the fact that several transistors are used to make a single DRAM cell but I cannot find any actual details on those sizes easily. From an electronics background it makes sense to me for this to be the case.
The ongoing march of reduced process sizes for microchips has probably helped a lot to reduce memory power requirements as well as the physical area required for each memory chip to the point where 32GB is both physically and electrically feasible. Tens of years ago 32GB of RAM may well have needed it's own electrical substation as well as a large enclosure to house it.
While it also helped make hard drive heads smaller and more effective in other ways, the benefits do not scale in the same ways.
4
See https://electronics.stackexchange.com/questions/210576/why-dram-costs-much-more-than-flash-memory
– Alan B – 2019-05-14T13:04:39.457@AlanB, Thanks for the useful link. – NiceGuy – 2019-05-14T13:11:20.320
In a capitalistic society you can expect the higher-performance component to be priced more than a lower-performance component regardless of true cost. Differences in laptop prices do not reflect the true cost of upgraded components. – sawdust – 2019-05-14T20:26:04.003