As for current music, I mostly listen to independent artists who are on Bandcamp, so I buy there to support them (and happily pay a bit more than asked to my favorites).
I buy music that is not available on Bandcamp from online stores that sell lossless quality, e.g. Qobuz.
For older mainstream stuff, I tend to buy used CDs and rip them.
Sometimes I still buy CDs (or vinyl), particularly special bundles with physical goodies, or I'm given them as presents (I still prefer a physical CD to a voucher for a download store).