The 2012 27" iMac with the i7 processor will be a bit faster than the MacMini with the same i7: 3.4 GHz (Core i7) vs 2.6 GHz (Core i7). The 20" 2012 iMac will be 3.1 GHz (Core i7).
The MacMini and 21.5" iMac can only handle 16 GB of memory whereas the 27" iMac can handle up to 32 GB. s
The Mini has 4 USB, 1 800 FW, 1 Thunderbolt 1 port. The iMacs have 4 USB, 2 Thunderbolt 1 ports.
You can get more info to compare with the free app MacTracker.
Be sure you're purchasing the unit from a reputable source and it's prepared for resale according to this Apple document: What to do before you sell or give away your Mac - Apple Support. It's important as you can get into a bad situation if it's not prepared properly. Also you might look into Apple's refurbished Macs to see if there's one in there that might meet your needs and budget. It will also come with a 1 year warranty.