Man, people sure are opinionated about this. Whether or not it was appropriate to make the bet in the first place (and then take his money), I have a little constructive criticism on your exercise...
First I think that an entire month without sugar might have been a bit too ambitious for the little guy. Candy is obviously a big part of his life right now and kids just don't have the kind of self control we grown people do. In retrospect you might have been better off setting an easier goal first, for example, lasting a few days without sugar or abstaining from certain sweets for a period of time. After winning that bet (or bets) he would have built some confidence in his ability to live without sugar in the long term, making him more likely to succeed. Plus he would have some of your cash in his pocket so the money he might later lose wouldn't be anything that you yourself hadn't given him.
Secondly I think a 20 spot is a bit much for a bet with a kid that age. I find that children today already have trouble understanding the value of a dollar, and I'm not sure if teaching him to wager that much this early is helpful. Bottom line, you shouldn't be making 20 dollar bets before you quit peeing with your pants around your ankles.
But hell, I don't know the kid so maybe he was ready to make the bet and his mom is just being a dyke.