RAM on iMac's has been user upgrade-able since at least 2014. I have a 2014 27" iMac and a 2017 27" iMac, and I upgraded the RAM on both of them. It's not a crazy "disassemble half the machine" type job either, it is really easily done via a panel in the back.
Only the 27" model has the access panel, the 21" model doesn't. I'm not actually sure if the RAM in the smaller one is soldered on or if it even has additional slots. But even if it does replacing it isn't something you can do easily.