What may not be widely known is that going from 256GB -> 512GB on M2-based machines also gives the SSD a huge speed bump, because 512GB is made up of 2x256GB chips with dual channels. Apple uses a single chip for 256GB configurations as a cost saving measure :(
For some use cases, you're even better off upgrading the base model M2 Air to 512GB vs upgrading the RAM from 8 to 16GB for a similar cost. This is because swapping suddenly becomes twice as fast.