I recently bought the M2 Mac mini to replace my aging iMac, and I love it. The iMac is one of the things that first attracted me to moving from Windows to Macs, but over the years, the drawback of all-in-one model has hit me hard. One time, the internals failed leaving me with a display that still worked, but getting it to work as an external display for another computer was a hassle. Another time, the display failed even though the internals are still working perfectly. Using that machine with an external monitor means having two monitors on a desk.
Having a Mac mini with monitor does involve a few more cables than the iMac, but I'm enjoying the peace of mind that if a display fails I can just replace the display, and hopefully the Mac mini will not fail anytime soon. Also, the desktop computer is my least used device. I use it for file management/backups, and the one or two apps I use that don't have an iPad version. So the price is right. The Mac mini is the lowest priced Mac Apple sells, and to me it makes the most sense. And so far, it's working very well for what I use it for.