Manual arbitrary code injection in Super Mario World [video]
youtube.com
youtube.com
The notes for how to replicate it can also be found in this Google Document[1] and the payload for the injected game itself is also available[2].
[1]: https://docs.google.com/document/d/1TJ6W7TI9fH3qXb2GrOqhtDAb...
Super Mario World Credits Warp Explained
Not saying this is the case for SMW, but there are certain cartridge games where this can happen naturally.
Probably not on SMW, but Pokemon is getting broken enough that it may some day be possible. There's already inventory-based exploits that can get saved across resets, but someone still has to play the game and open up the inventory screen for that.