Maaseros 2:7-8
Maasros 2:7
If a person hires a worker to lay his figs out to dry and the worker stipulates a condition that he should be able to eat from them, he may do so exempt from tithes. If he stipulates that both he and his son should be permitted to eat figs, or that he may eat the value of his wages, then he may eat without tithing but his son must tithe. If he stipulates that he should be able to eat figs both during and after his work, he may eat without tithing during his work but he must take tithes after. This is because the Torah allows a worker to eat while he works but it does not permit him to eat untithed produce after he has finished working. The general principle is that whatever the Torah permits one to eat may be eaten untithed, otherwise it must be tithed.
Maasros 2:8
If he was working with lesser-quality figs, he may not eat higher-quality figs; if he was working with higher-quality figs, he may not eat lesser-quality figs. What he can do is wait until he reaches the kind of fruit he wants to eat and then eat it as he works with it. If two workers exchange their portions, both intending to eat the figs, both intending to dry them, or one intending to eat them and the other intending to dry them, they must take tithes. Rabbi Yehuda says that the one who exchanges in order to eat the figs is liable in tithes but the one who exchanges in order to dry them is exempt.