Pretty sure that's nothing to do with the price - Apple were charging the same per-GB rate for upgrades to the Intel Mac Mini and iMac which used totally different DDR4 DIMMS until they were dropped. No reason to believe that the surface-mount LPDDR modules in the SoC are any different to the surface-mount LPDDR modules in other manufacturer's laptops. I'd bet that the extra logistics in having 3 versions of the M2 SoC costs Apple more than the difference in RAM chip prices.True that. I wonder what the price difference actually IS at the wholesale level that Apple buys.
However, Apple's base price (which is what attracts punters in) will doubtless be influenced by what proportion of customers they can sell high-margin BTO upgrades to - lower the headline price to get more sales, make it back on upgrades. Also, the models on offer at third party retailers (who still expect to take a slice of the purchase price so they can eat hot meals and sleep indoors, the scroungers!) are typically base models, while needing a BTO version pushes people to the Apple store (Apple gets to keep all the money).
Apple didn't get to be a however-many-trillion company by accident!