The iMac is long overdue for a redesign, and many expect that to occur with the move to the M1. If being able to run Windows as well isn't a concern, then it's the better long term bet. The M1 mini packs a lot of performance, and is very good value as far as Apple products go, but is leading edge, and all that implies.
For the current Intel iMacs, the Apple
refurbished store is a good option, but stock varies, and goes quickly once made available, so it's a stalk and strike quickly deal. The factory-refurbished units are indistinguishable from new, except for a plain box, carry the same warranty, and are eligible for the AppleCare extended warranty. The ~15% discount isn't great, but is better than nothing.
The 27" models still have user-accessible RAM slots, so upgrades can be done without having to pay the high prices Apple charges for more memory. The more recent 21" models can be expanded, but only by disassembly, probably best done by a service provider.
Unless custom ordered, 2019 and prior models had Fusion hybrid drives as standard, combining a small SSD with a spinning drive. Of those, it's better to get a 2TB model or higher, since they have a decently sized SSD (128GB). The smaller capacity models have a paltry 32GB SSD. Fusion drives are fine for most users, but a pure SSD model is preferable, and since they were custom configurations, available only direct from Apple, some dealers, and through the refurb store.
The 2020 models switched to pure SSDs. Current models take a few months before they become available in the refurb store.
If buying new, Apple often structures the options so that it's better value to step up to the next trim level, rather than optioning up a base model, so keep that in mind, and play with the configuration options and weigh the specs. Very much like buying a car.