This is why electronics are so cheap a year or two after it's released. The real investment is in the development, and when a new generation comes out, that old development is "worthless".
Some years ago you would pay $100 for a 128MB usb-stick. Now you get a 2GB for less than $5.
The fab cost is tremendous. Samsung has recently started production of 10nm NAND flash. They're building (it might even be ready by now) a new fab for mass production of 10nm NAND flash which costs $7 billion.
The 128MB usb-stick you paid $100 for several years ago was made using an old technology in a fab which might even have been closed down by now.
The $5 2GB stick could not even be made using the old technology (unless you used lots of dies or chips making them bulky and power hungry). The feature size have decreased so the density have increased which will fit more devices on a wafer, so each device gets cheaper, if the defects are fairly constant across the wafer the yield in terms of number of devices will go up.