I bought a song that is 24bit 192khz. I want to lower it to 48khz.
It looks like this in a spectrogram:
After opening this file in Audacity I go to “Tracks” and then “Resample” and set it to 48000.
This seemingly works fine and after it’s done it looks like this: https://imgur.com/SjF77VG
So I export it as flac at 24bit and it seemingly works like intended, but after putting it in a spectrogram it looks like this: https://imgur.com/OLeyfVJ
Then when I open this file again in Audacity the sample rate is 192000 again.
The Audcaity project-rate is set the same as the first file opened, in your case 192kHz.
Resampling the track in Audacity to to 48kHz did not change the project-rate.
So when you export the audio, the sample-rate is the project-rate, which is still 192kHz, (not 48kHz).
This will change in a future version of Audacity (possibly the upcoming 3.4.0)
The Export dialog is being reworked to offer more control options at export time, one of which will be the sample rate of the exported file (so no longer relying on the, now hidden, Project Sample Rate).
It is also possible that importing (the first audio file) will no longer change the Project Sample rate that you have set. There is a GitHub issue logged for this, but it remains yet to be implemented.