J.S.
I've had similar situations in the past, but in addition to the "Thank you, but no" I always add that "I've taught my daughters not to take candy from strangers and I wouldn't be setting a good example by breaking that rule."
That way I take the "OMG how dare you offer candy to my kid!!!!" offense and put the onus on me even though the other person shouldn't have offered my kid candy. I'm proud of my girls, though... a couple of different times (once from another customer and once from a cashier) before I had a chance to say it myself my daughters said, "Thank you but we can't take candy from strangers. You're nice but you're still a stranger."