The Tur wrote: One of the brothers who performed shoshvinut for his friend during his father's lifetime, and his father gave him what he sent, and the father died and the one for whom the shoshvinut was performed came to repay—if the father designated it for this one when he sent it, such that he said to him, "Go and perform shoshvinut for so-and-so," now when it returns, it belongs to him alone. But if he did not designate it for any specific one, but rather said, "One of you shall perform shoshvinut for so-and-so," and this one stood up of his own accord and performed it—it returns to all of them and they divide it equally as with other debts of their father. And he does not need to return everything at the marriage of the first one who marries, but rather the first one who marries pays the portion that reaches him. And regarding the matter of the sender's rejoicing with the brothers, the Ramah wrote: If they all rejoiced with him, when he returns it to each and every one, he must rejoice with him, and if it is impossible for him to rejoice, he must deduct from it for him. And if they did not rejoice with him, but rather only one of the brothers, he also only has to rejoice with the one who rejoiced with him, and if it is impossible for him to rejoice, he deducts from his portion; but to all the others, when they marry, he gives each one his portion and does not deduct anything from him. Thus far his words. [This is for the Tur the explanation of the baraita there, that he sent shoshvinut to his father, see there; and for the Rambam in chapter 9 of Hilkhot Nachalot there is another explanation for this, and it was explained in Choshen Mishpat siman 286, see there].
כתב הטור: אחד מן האחין שעשה שושבינות לרעהו בחיי אביו ואביו נתן לו מה ששלח ומת האב ובא אותו שנעשה לו שושבינות לפרוע, אם ייחד האב לזה כששלחו שא"ל "לך ותעשה שושבינות לפלוני", עתה כשחוזרת היא לו לבדו, ואם לא ייחד לשום אחד אלא אמר "אחד מכם יעשה שושבינות לפלוני" ועמד זה מעצמו ועשאו – חוזרת לכולם וחולקין בו בשוה כמו בשאר מלוות אביהם, וא"צ להחזיר הכל בנשואי הראשון שנושא, אלא ראשון שנושא משלם חלקו המגיע לו. ולעניין שמחת המשתלח עם האחים, כתב הרמ"ה אם שמחו כולם עמו, כשמחזיר לכל אחד ואחד צריך לשמוח עמו, ואם א"א לו לשמוח צריך לנכות לו, ואם לא שמחו עמו אלא אחד מן האחין גם הוא אין לו לשמוח אלא עם אותו ששמח עמו, ואם א"א לו לשמוח מנכה לו מחלקו, אבל לכל האחרים כשישאו נותן לכל אחד חלקו ואינו מנכה לו כלום, עכ"ל. [זהו להטור פירוש הברייתא שם דשלח לאביו שושבינות ע"ש, ולהרמב"ם בפ"ט מנחלות יש פירוש אחר בזה ונתבאר בחו"מ סי' רפ"ו, ע"ש].