The differences actually are quite huge. As far as I know, the M series chips all use LPDDR5 RAM, which is indeed more expensive than the DIMM/SO-DIMM modules you would add to your diy build.
Still, you can easily get a good kit of DDR5 DIMMs for 110€/32GB from a retailer. So while LPDDR5 RAM is more expensive, it is most certainly not expensive enough to justify a 230€/8GB price as being driven by BOM costs