In theory, you could fill a collection this way.
For old cartridge-based consoles, special pieces of hardware hardware makes it possible to copy games over to your computer.
And where do ROMs come from? If a game comes on a DVD, like the PlayStation 2 or the Nintendo Wii, you can actually rip games yourself using a standard DVD drive to create ISO files.