RAM uses a different process than the logic nodes you describe. RAM uses tons of capacitors, along with the the transistors.
Then there is the HBM which is an expensive process to mount on the chip.