I totally commend you on your intent... you truly meant well, and I as a parent of a couple of kids older than 8 years old, would have really appreciated your effort in trying to get my kid to eat better, and be aware of his health.
On the other hand, I would have really been shocked and a little bit pissed off, if the babysitter actually took $20.00 from my kid because he lost a bet. Eight year olds have absolutely no concept of money, because they rarely purchase things, and rely on mom and dad $100% for their needs. $20.00 to an 8 year old, is like $100.00 to an adult. I'm sure that money, was allowance money, given to him by his mother, in the first place. Honestly, don't quit the job over something this trivial, which you initiated in the first place. A child of 8 would have done wonderful on a point/reward system to reach such goal. Money, and its value, is still way over their heads, but not to the parent, who probably sees it as you taking advantage of their child, and THEIR (the parents) money, since it was given to the child by mom in the first place. I think you expected way too much, and then held the kid accountable for something he couldn't possibly uphold at that age.
Do the right thing, return the $20.00, and instead, take it as a learning experience. Point systems, charting and rewards in this situation would be much more appropriate, understood, and enjoyed rather than a monetary bet. An 8 year old is only 1 year beyond the legal definition of the "age of reason". One of my kids is 13, and he STILL has no idea of the value of money, or self restraint for that matter. Please give back that $20.00. I can see why the mom is upset. You meant well though, but it wasn't a fair bet, even if you didn't recognize that.
Edit: Teach him by example. When you are babysitting, eat healthy, and show him by example, all the alternatives to sugar that there are. Maybe it will rub off on his mom! :D