It's all done by Hex Codes!
When Action Replay/any other hack is used, it changed what's known as a Hex Code that decides the functions of the game in the chip that's inserted in it. When you hack a game, it changes the Hex Code to function the way you want it to work. For example, if the chance of a wild Arceus appearing in the wild is built up of the Hex Code 89789898-97897897, then the hacking will change it to 82957835-23849787, which could probably mean a 90% chance of an Arceus appearing anywhere in the overworld grass.