The Gemara (65b) tells a number of stories that illustrate the rule about renting a non-Jew’s rights to the courtyard in order to allow for the creation of an eiruv. In one story, a number of amoraim were staying at an inn, and did not have an opportunity to rent the non-Jew’s space prior to Shabbat, simply because he was not around at that time. When he arrived, Shabbat had already begun. A discussion ensued as to whether renting from the non-Jew was similar to establishing an eiruv, which needs to be done before Shabbat begins, or, perhaps, it is more similar to the rule of being mevatel reshut – turning over one’s rights in the courtyard to the others in order to allow them to carry – which can be done even on Shabbat.
Rabbi Hanina bar Yosef said: Let us rent, while Rabbi Asi said: Let us not rent. Rabbi Hiyya bar Abba said to them: Let us rely now on the words of the Elder, Rabbi Hanina bar Yosef, and rent. Later they came and asked Rabbi Yohanan about the matter, and he said to them: You acted well when you rented.
A similar story appears in the Jerusalem Talmud, where it is recorded that in response to Rabbi Yohanan’s comment “it is a good thing that you arranged to rent it” Resh Lakish said “it is not a good thing.” The ensuing discussion in the Jerusalem Talmud revolves around whether this is a disagreement about the halakha. One opinion is that Rabbi Yohanan feels that such a transaction can be done on Shabbat, permitting the eiruv, while Resh Lakish rules that it cannot be done on Shabbat and any such arrangement must be concluded prior to Shabbat. The other opinion understands that Resh Lakish did not fully understand what had taken place, and he thought that they had not concluded a rental agreement at all. His statement was “it is not a good thing that you carried.” In any case, the accepted halakha (see Shulhan Arukh, Orah Hayyim 383) allows for such an arrangement to be made with a non-Jew even on Shabbat in order to facilitate carrying.