It works by looking for certain code in the exe and changing it somehow.
Q: How does MoleBox work?
A: When you're packing your application, MoleBox scans its import table, locates WinAPI functions operating with the files being packed, and replaces them with its own functions.
http://www.molebox.com/faq.shtml
And you can use also config files that are outside the box, and freely editable:
http://www.molestudio.com/forum/viewtopic.php?t=31