100b----------------------------------------100b

1) THE WAY A CRAFTSMAN ACQUIRES THE ITEM ON WHICH HE WORKS
QUESTION: The Mishnah teaches that when one gives wool to a dyer to dye for him and the dyer uses an inferior dye, both Rebbi Yehudah and Rebbi Meir agree that the dyer does not acquire the wool and must return the wool (or its value) to its owner, and he receives in return the lesser of the Shevach (increase in value of the wool) or Yetzi'ah (his expenses).
The Gemara earlier (98b) teaches that when a craftsman works on an item, he acquires the item by causing it to appreciate in value. This implies that just as a thief acquires a stolen item through a Shinuy (making a change in the item), a craftsman who changes an item and causes it to appreciate in value also acquires the item, and he merely owes the owner an amount of money that corresponds to the original value of the item. Consequently, when the craftsman returns the object to its original owner and receives his wages, it is viewed as a sale. (See Background to Bava Kama 98:35.)
Accordingly, why should every craftsman not be able to tell the owner of the item that he has decided to keep the item for himself and not "sell" it back to the owner? The obvious answer is that the craftsman may not refuse to return the item he worked on when he is paid the full wages that were stipulated, since there is an implicit agreement between the owner and the craftsman that the craftsman will return the finished item upon receiving his wages.
However, this does not suffice to explain the Halachah of the Mishnah. Why must the craftsman return the wool to its owner when he dyes it with an inferior dye? He should be able to keep it for himself and pay for the value of the wool that was given to him (as Rebbi Meir says in the last case of the Mishnah), since he is not being paid the full wages that were stipulated. (See TOSFOS RID to 98b.)
ANSWERS:
(a) The RASHBA explains that a craftsman has ownership of the Shevach, the amount that the item appreciated, only when the item becomes ruined before he returns it. This is because no craftsman wants to work on the item only to cause himself to pay the owner, as compensation, the amount that the object appreciated. It is assumed that there is an implicit stipulation that the craftsman will be considered the owner of the object in the event that it breaks after he starts to work on it but before he returns it to the owner. If the object does not break, the craftsman owns only an amount corresponding to the wages that he deserves for the work (since that was his implicit stipulation when he accepted the work, so that he would be entitled to hold the item in lieu of his wages).
According to the Rashba, the craftsman must return the wool to the owner in the case of the Mishnah because he does receive the wages he deserves for his labor. That is, when he dyed the wool in an inferior way, the craftsman owns only a part of the item, the part that corresponds to the lesser value of the Shevach or the Yetzi'ah, because that is the wages which he deserves in this case. (See following Insight, 2:c.)
(b) The RA'AVAD writes that it is possible that the craftsman acquires the entire amount of appreciation that he caused, even if the item does not become ruined. This also seems to be the opinion of the TOSFOS RID. Nevertheless, the Tosfos Rid writes that although the craftsman owns part of the item, he is not able to acquire the entire item with a Shinuy since he is not a thief (and only a thief acquires the entire object with a Shinuy). Therefore, he must return the original item to its owner along with all of the improvements that he made to it. Afterwards, in return for his labor, he receives either the Shevach or the Yetzi'ah, as the Mishnah states.
The Tosfos Rid and Ra'avad seem to understand that the Kinyan of a craftsman is related to implicit agreements in the hiring of a craftsman (as the Rashba explains), and is not related to the Kinyan of a thief which is based on a Shinuy.
(c) RABEINU YEHONASAN in the Shitah Mekubetzes implies that a craftsman acquires the item on which he works through making a Shinuy to it, just as a thief acquires the item that he steals through making a Shinuy to the item. Accordingly, the question returns: why may the craftsman not withhold the item in a case in which he dyes it in an inferior way?
Perhaps Rashi here addresses this question. Rashi (DH Tzav'o Ka'ur; see also Nimukei Yosef) writes that when the craftsman dyes the wool in an inferior way, he is a Mazik b'Kavanah, an intentional Mazik. That is why Rebbi Meir agrees that he must return the wool to the owner. The RASHASH asks, why does Rashi give this explanation for why Rebbi Meir agrees that the craftsman may not keep the wool in this case? Rashi himself writes later (DH v'Im ha'Shevach) that dyeing the wool in an inferior manner is not called a Shinuy, and that is the reason why the craftsman must return the wool to its owner!
Perhaps Rashi means that even if the craftsman cannot acquire the item through a Shinuy (the Shinuy that he did not follow the instructions of the owner), he should acquire it through the Shevach Kli (for following the instructions of the owner)! Rashi answers that if he dyed it in an inferior manner, although he followed the words of the owner and the change he made is not considered a Shinuy that makes him a thief, nevertheless he did not follow the intention of the owner and, therefore, he cannot acquire the item through Shevach Kli. Rather, he is a Mazik b'Kavanah who is like neither a Gazlan nor a craftsman.
2) ASSESSING THE VALUE OF THE "SHEVACH" AND THE "YETZI'AH"
OPINIONS: The Mishnah teaches that when the craftsman does not do what the owner of the item instructed him to do, in certain cases the ruling is that the owner may pay either the Shevach or the Yetzi'ah, whichever is less. How are the values of the Shevach and the Yetzi'ah assessed?
(a) RASHI and RABEINU YEHONASAN MI'LUNIL (in the Shitah Mekubetzes) explain these concepts in their literal sense. The Shevach refers to the amount that the item increased in value from the time it was given to the craftsman. The Yetzi'ah refers to the amount of money that the craftsman put into the item in order to cause the Shevach, the increase in value.
(b) The RI in Tosfos and the ROSH offer a different explanation based on the Yerushalmi here. The Ri explains that the Yetzi'ah refers to the original wages that the owner promised to give the craftsman for doing his job properly. The Shevach does not refer to the entire amount that the item increased in value. Rather, the amount of profit which the owner intended to make by hiring the craftsman to do the job is assessed. For example, if the wool and dye are worth 10 Zuz together, and the craftsman charges 10 Zuz to dye it, and the finished product is worth 25 Zuz, the owner's intention was to increase the value of his property by 5 Zuz. The first 5 Zuz that the wool increases in value are therefore ignored because the craftsman accepted upon himself the responsibility to see to it that the wool would return a 5-Zuz profit for the owner. Whatever increase in value remains besides that 5-Zuz profit is referred to as the Shevach, and the owner now has the choice to give either that Shevach to the craftsman or to give the original wages that were stipulated, whichever is less.
(c) Tosfos cites RABEINU ELCHANAN who apparently interprets the Yerushalmi in a different manner. Rabeinu Elchanan's explanation is cited by the HAGAHOS ASHIRI and by the TOSFOS SHANTZ in the Shitah Mekubetzes. Rabeinu Elchanan explains that the Yetzi'ah refers neither to the amount originally promised to the craftsman nor to the amount the craftsman actually spent on dyeing the wool, but to the amount expended by the craftsman including his labor. That is, the Yetzi'ah is assessed by determining the amount of time and effort the craftsman invested into dyeing the wool, based on the market rate of hired labor in that place and at that time. (This is also the opinion of TOSFOS RABEINU PERETZ.) If this amount, the Yetzi'ah, is less than the increase in the value of the wool, then the owner must give the craftsman only the Shevach, the amount that corresponds to the increase in value.
Rabeinu Elchanan agrees with the Ri who says that the amount that corresponds to the intended profit of the owner is not taken into account when the value of the Shevach is calculated.
However, Rabeinu Elchanan adds that if there is a large increase in the value of the wool, such that the increase is greater than the Yetzi'ah, it might not suffice to give the craftsman the amount of money that corresponds to the Yetzi'ah, which is based on the wages of a Sechir Yom, a hired laborer. The reason for this is that the craftsman acquires in the wool an amount that corresponds to the effort which he put into it. Therefore, if the value of the wool increased more than that amount, part of the increase may be attributed to his portion of the wool. For example, the wool (plus the intended profit of the owner, as the Ri discusses) is worth 10 Zuz, and the craftsman put in 5 Zuz worth of effort, and now it is worth 30 Zuz, making a total increase of 20 Zuz. An amount of 5 Zuz of the increase belongs to the craftsman. The other 15 Zuz may be divided into three parts, of which the craftsman's portion, which is a third of the wool, increased one part, and the owner's portion (two-thirds of the wool) increased two parts. Therefore, the owner cannot give the craftsman any less than 10 Zuz of the total (that is, he may not give him simply the 5 Zuz of effort that the craftsman expended).