Worms that germinate in vessels or cisterns are permitted to be eaten, since the requirement of fins and scales applies only to creatures originating in seas and rivers. This permit equally applies to other beverages.
Ran Huna said the rule: one should not pour beer through a sifter of wood chips at night, because a worm may part from the beer and crawl upon a chip momentarily. When it does, it becomes a creature that creeps upon the ground, and one would transgress a prohibition if he eats it while drinking the beer. But if so, let us suspect that the worm departed from the beer and adhered to the wall of the vessel and then fell back!? – That would not be a problem. The interior wall of the vessel is considered the worm's natural habitat, and the worm is not considered parted from the vessel.
Similarly, worms that germinate in detached fruit are permitted, until they emerge and crawl on the ground. Rav Yosef inquired, if a worm germinated in a detached fruit and died upon contact with the ground, or only part of the worm emerged, or if one swallowed it in mid-air? – Unresolved.
Art: William Huggins - The Diet of Worms
Eruvin 63 – Respect for one’s teacher
16 hours ago