The gatcha is that most of the code behind the emulators is open source. Nintendo and Sony let the hackers do most of the work for free, then can fork it, polish it (or at the very least copy the archetecture) include a copy of the open source license in fine print somewhere and call it a day.