Buy the latest year of a body style you can, each redesign means new modules and reliability problems are fixed with each new yearly revision. Then buy one that has depreciated most of the way already. 7-10 yr old is a sweet spot. C classes are kinda rickety imo. An E or S class is ideal. Lastly, if you get one that actually was maintained well, it shouldn't have any issues waiting to bite you.
Currently rocking a 2010 S400, immaculate interior and exterior. I'm all in for about 12k after repairs, would be closer to 16-18k if I paid someone to do the repairs. This vehicle won't depreciate more than $500 a year at this point. It's MSRP in 2010 was 113k.
I drove a 2022 Volvo S60 t8 recharge for a little bit earlier this year, the 13 year old s-class drives better and has nicer features...
Of course this is all moot if you're trying to buy very new models, in that case, you gotta love blowing money. Hah