Apple's refreshed 27-inch Retina iMacs can be configured with up to 32 gigabytes of RAM via the Apple Online Store.
Thankfully, these machines have changeable RAM slots due to the larger form factor, permitting users to double the RAM to 64 gigabytes total after the purchase with third-party RAM upgrades.
On the other hand, the new 21.5-inch iMac with Retina 4K display uses soldered memory chips so you'll have to configure it with either 8GB or 16GB of RAM at the time of your purchase.