For me, it comes down to two simple guidelines.
1. Players should strive to not meta-game
2. DMs should never police players decisions with their PCs
However, the DM, having complete control of their world, has every right to create purposeful anti-metagaming encounters. ie
- Fire causes the Troll to regain HP
- Fruit requiring a constitution save upon eating was to determine if the antidote to the poisonous air in the room took effect in time to save the PC. And what a way for the NPC to see if the characters follow the hospitality rules of the culture!
Note that in either example above, the DM should make this decision before the actual encounter, and when it makes sense, give the PCs a chance to gain that knowledge before the encounter takes place.