MAME is a non-profit emulator, it was designed exclusively for educational purposes and for preservation purposes, in order to prevent historical games from disappearing forever. Of course, to preserve the games and demonstrate that the behavior matches the original, you must also be able to play the games.
It is not the intent of the developers to infringe copyright on any patents or on the original games. All MAME source code is open. To work, the emulator requires original images from ROMs, CDs, hard drives or from the arcade machine, which must be provided by the user. No portion of the original game is included in the executable code.