My late-mother used to do the same thing when I was a kid. I'm 19 now, and she's no longer on this earth, but she used to do the exact same thing. She'd buy me something (an ice cream, for example) and then say I better get on a diet & cut down on my junk food. I was always at my correct weight, exercised regularly, ate very healthy at home, and had junk food maybe once a month. So when I had that ice cream she bought me, and got that comment, the last time I would have had junk was like a month ago, or sometimes more.
I think parents just think (through some sort of weird glasses) that they're kids are ALWAYS eating junk food, even if they aren't. It's just one of those things that tend to go together in parents head, that kids are unhealthy eaters and always eating junk.