The iMac update I had been waiting for a couple months ago finally happened so I could compare the Mini I got (because it already had been updated) to the new iMacs. Prices are based on my military/veterans discount which is better than the education discounts I used to use.
I spent $1349 for the Mini since I went with the base 6-core rather than 4 core, jacked the ram to 16 GB and got 512 GB SSD.
The same processor, ram, and SSD on the iMac costed $720 more. Of course, I would have gained a really nice 27 inch monitor, a keyboard, and a mouse. But I sure don't need another mouse and keyboard, so that leaves the monitor. But for about $320, I got a 43 inch LG TV to use as a monitor. This has about 2.5 times the area of the iMac screen! Quality would not be as good, but frankly, I don't think I'll generally notice. The fact that it is 4k is sufficient for my preferences anyway - clarity of text! Certainly looks great for movies too, but that is secondary for me. And besides the additional space, I can just inputs to use it as a TV if I want a special experience (normally I use a cheaper and smaller 1080p TV for watching television).
So, net savings of $400 and a much bigger screen. Oh, and while the iMac has 4 USB 3.1 ports (double what the Mini has), it only has 2 Thunderbolt 3 ports (half what the Mini has). While I'd love to have more USB 3.1 ports, giving a choice, I'd rather have the Thunderbolt and this will probably be even more important over time. Sure, right now I use an adaptor for one regular USB device, but that's not a big deal.
iMac has a display port while the Mini has HDMI.
Now, looking forward to when I buy another computer, assuming the Mini continues to be updated (which isn't a given), I only have to replace the computer, but keep the screen. Likewise, if I decide I want an even better screen, I only have to replace that. If the Mini isn't updated then maybe I would have to look at an iMac again, but I'll still have saved a considerable amount of money this time. And could still use the screen I use with the mini as another screen for the iMac if I wanted. The Mini could then be used as a server. I guess an old iMac could do that too, but would be much less convenient.