Q. Is it true that if I find a worm inside a fruit that did not crawl out from the inside of the fruit, it is kosher and one may eat it? Does that mean it can be just picked up, with or without a piece of fruit and be eaten? What bracha does one make on it? Can one dip it in chocolate syrup and dried it as the goyim do (with ants)?
A. The Torah prohibits the consumption of worms, and all other insects, as it is written; (Vayikra 41: 11) And any creeping creature that creeps on the ground is an abomination; it shall not be eaten. The prohibition on eating any sheretz is very severe and often the consumption of a single insect may be a concurrent violation of multiple Biblical proscriptions.(Makos 16b).
There are, however, some exceptions to the rule. One of them is that it is permitted to eat a worm that grew in a fruit that has been detached from the ground and has never crawled out of the fruit or been exposed even partially to the outside air, even if it then returns to the inside. However, worms and other insects which grew in a fruit while it was still attached to the tree are forbidden to be eaten. (Chulin 67a - Shulchan Aruch Y.D. 84: 4). When in doubt, since we are dealing with numerous severe Biblical prohibitions, they remain forbidden. (ibid: 7 and Shach 21, and Pri Megodim 384: 21).
From the above it is apparent, that unless the fruits where grown in a controlled laboratory environment, there would a sofek or doubt at what point the worms developed, and thus prohibited.
Even if there was certainty that the worm developed after the fruit was already detached and they never left the inside of the fruit, there would be prohibited due to the Baal Teshaktzu or eating foods which are disgusting proscription: (Avoda Zara 68b, Maharshal, quoted in Taz 84: 23, Yam Shel Shlomo - Eilu Treifos 104).
Shevet Halevy (7: 123: 3) quoting from Minchas Chinuch (163: 8), rules that even when not prohibited because of sheretz, if eaten with the fruit there would be a Rabbinical prohibition of Baal Teshaktzu. However, if eaten separately, it would be Biblical.
Additionally Shach (Y.D. 84: 46) mentions that there is also a prohibition of Maaras Ayin (doing something that to the observer may appear as a prohibited act).
Horav Shlomo Miller's Shlit'a opinion is similar.
Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit'a