I think my children's school is fairly strict on what children take in their packed lunches. I got a message once (via DS) that he wasn't supposed to have chocolate as it is unhealthy and said chocolate was sent back with him. It was 2 mini eggs and I thought that was overkill considering a) it was the only time he'd had chocolate in his lunch box and was a treat, and personally I think treats now and then are totally fine! and b) they have pudding every lunchtime if they have school dinners and this 3x a week it is cake and custard, often something with chocolate.
It is definitely important to make sure children have good nutrition but I don't think it is fair to make the child feel bad if they have something which isn't allowed, as presumably they're not the ones packing their lunch.
Luckily our school is pretty relaxed about this kind of thing. Dd3 has school dinners (they're free) and dd2 packed lunch. I always pack a treat i.e crisps, homemade cake, cereal bar, it differs, I don't see any difference than the dessert that is given with school meals?
Personally I don't give chocolate, our rules but chocolate and sweets are always after dinner and only once or twice a week. Other than that if I was to get a letter/note home about the 'treat' that they had taken in then without doubt they would be getting a note back, if they deem it acceptable to be giving out treats and desserts as part of they're healthy school meals then no way are they going to be telling me otherwise