That doesn't keep it legal.
That law exists/existed to allow owners of software which was distributed on a volatile storage format (I.e. Floppy disks) to create a single backup in order to protect themselves from accidental loss.
Besides, distribution of the ROMs is what's considerably more illegal, not that anyone seems to care anymore. ROM sites have been up and thriving for a long time now. It seems as though Nintendo and the like have just given up on trying to police ROM distribution.
You're allowed to make a backup of nearly any format -- volatile or not. I'm not trying to say it makes it 100% legal, but it's plenty close enough. Plus, like you said, it's the distribution.
Not to belabor the point, but the DMCA very clearly states that any measure taken to circumvent copy protection is illegal, whether it's to make a personal backup or otherwise. Nintendo used a proprietary cartridge format along with masked ROMs in order to prevent piracy.
The old laws weren't terribly specific, but they were created because of the inherent long-term issues with software being distributed on floppy disks. Making copies of software stored on something like an optical disc or cartridge wasn't what the law was intended to cover. But the DMCA is very specific about what is acceptable and what isn't.
But there's obviously no way to police people making a personal backup or backups, which is likely why it took so long for the laws to be more clearly defined via the DMCA, which was essentially created by and campaigned for by the music, movie, and game industries.