If you want to mine on CPU, buy Ryzen 2000, 3000 & 5000 series from the second hand market.
3000 & 5000 series basically have same performance for most mining algorithms. Ryzen 1000 just might work if you get them for free as I see people offloading them for real cheap these days. But power consumption might not be optimal for the performance.
They are usually cheap enough for it to be "manageable" if you are adventurous to take a potential no win scenario but just break even.
Don't buy the newest stuff because you will never get back the investment in time.
I don't do this myself but looked into it briefly at times. It's never profitable to put in as a investment but if you have a large cache of used parts it could be done as a side hobby.
If you are upgrading your main PC just for the latest & greatest, your old PC's could be used for this unless you want to hand it over to someone else to be sold or such as parts.
Used parts market have a large supply of potential cheap processors to be used these days with decent performance per unit to be much better than buying the newest generation.
Though GPU mining is much easier to setup & get a return faster.