Is it the technology?
* Flash cells can store more data an be produced cheaper per cell. But they are more complex to read out and slower.
This can explain some factor, but the factor of 40 given by OP probably not.
* Flash and DRAM probably use different processes.
This could explain a bit but look at the next point...
* DRAM has a much longer history and (at least in the beginning) much higher capital investment.
...which means that DRAM should have the technological advantage. At least through economies of scale.
Is the cumulative investment in flash research already much bigger compared to DRAM research?
Is the process used to produce flash memory so much easier?
Is it the market?
* Obviously people pay the price.
* With DRAM people are hungry for performance more than they are for size.
* We already have more than enough DRAM. The latest MacBookPro demonstrates that 16 GB DRAM is enough for just about everybody but flash storage goes up to 1 TB.
* Of those 16 GB DRAM the speed and power consumption are much more important than the raw size.
Coming back to the cumulative investment. I think that the primary pain point for flash has been the price per GB. Flash could be stronger, faster, more reliable, less power consuming but those are all secondary. It is fast and reliable enough by using very complex RAID controllers. The power consumption is not as bad as HDDs already use a lot and the data mostly just sits around. The main driving point is the price per GB. This is where the money goes in flash development.
On the other hand for DRAM, after some point, it is mostly speed and power driven. Reliability has to be comparatively high as every cell must work over years. Size is mostly increased by improving semiconductor processes where flash probably uses a lot of the same technology. Using the layer stacking technologies of flash is probably not yet applicable because it is not reliable enough and not compatible with the cell layout, maybe it never will.
If we really were hungry for so much RAM we would probably get it. But we aren't. It's good enough. Progress slows down.