Hey me I, it kinda depends on how specific you are meaning.
If you mean what I think you mean which is taking a copy of game like Sonic 2, hacking it and putting it back on the very same cart then no, for all intents and purposes this isn't possible. The chip on the cart is read only, which means you can only read from it, not write to it (it's also where the acronym ROM comes from, read only memory).
However, there are carts out there that are being increasingly targeted at at Joe Everyman that use a different kind of memory such as SD cards (like you put in your phone or camera) which can be used to play hacks via a cart on the real hardware.
My favourite example is the EverDrive since it is incredible simple to use, doesn't require mad soldering skills and is priced really well for all the capabilities it opens up for you.