Exercise allows you to eat more.
5 pounds of muscle burns more calories at rest than 5 pounds of body fat. Basically, the more muscle you have, the higher your resting metabolic rate. And, of course, you also burn calories while you're actually exercising.
This means that "cheating" with a cookie once in a while isn't going to take you back 10 steps. It doesn't mean you can eat whatever you want whenever you want, but you can afford to enjoy some of the things you really like when you exercise regularly. Regular exercise makes it easier to get away with those things in moderation.