Reference for Bava Metzia 7:2
וְאֵלּוּ אוֹכְלִין מִן הַתּוֹרָה. הָעוֹשֶׂה בִמְחֻבָּר לַקַּרְקַע, בִּשְׁעַת גְּמַר מְלָאכָה, וּבְתָלוּשׁ מִן הַקַּרְקַע, עַד שֶׁלֹּא נִגְמְרָה מְלַאכְתּוֹ, בְּדָבָר שֶׁגִּדּוּלוֹ מִן הָאָרֶץ. וְאֵלּוּ שֶׁאֵין אוֹכְלִין. הָעוֹשֶׂה בִמְחֻבָּר לַקַּרְקַע בְּשָׁעָה שֶׁאֵין גְּמַר מְלָאכָה, וּבְתָלוּשׁ מִן הַקַּרְקַע מֵאַחַר שֶׁנִּגְמְרָה מְלַאכְתּוֹ, וּבְדָבָר שֶׁאֵין גִּדּוּלוֹ מִן הָאָרֶץ:
And these [workers] eat [from what they are occupied with] by Torah law: one who is occupied with what is rooted in the ground, at the end of their work [i.e., when they tear it out, viz. Deuteronomy 23:25): "But into your vessel, you shall not place them" — When you are placing them into the owner's vessels you may eat; that is, when they are being torn out.], and [one who is occupied] with what is torn from the ground [may eat that thing] until its labor is completed [for tithing, if it is subject to tithing, or until its labor is completed for challah, if it is subject to challah], (this,) with a thing that grows in the ground. And these do not eat: one who works in what is rooted to the ground, not at the end of the work, and (one who works) in what is torn from the ground after its work has been completed (for tithing or challah), and (one who works) in what does not grow in the ground. [viz. (Deuteronomy 25:4): "You shall not muzzle an ox in its threshing. Its not being written: "You shall not thresh with muzzling" implies that the muzzler is to be likened to the muzzled, and the muzzled to the muzzler, viz.: Just as the muzzled, the ox, eats what is "torn" (from the ground, i.e., the "threshing"), when it works, so the muzzler, the man, eats of what is "torn" when he is working in it; and just as the muzzler, etc. And just as "threshing" is characterized as something which grows in the ground and whose labor is not completed for tithing, and at the end of the work the laborer may eat of it — so, all things which grow in the ground and whose labor has not been completed for tithing may be eaten by the laborer at the end of the work: to exclude a laborer engaged in milking, whipping (milk), or processing cheese, which (products) do not grow in the ground; to exclude a laborer engaged in the separation of dates and figs which are stuck together, their labor having been completed for tithing; and to exclude a laborer engaged in "weeding" garlic and onions, removing the small ones, which will never mature, from the others, to provide more growing space for the large ones, this not being the end of the work. A laborer does not eat all of these and their like.]