רֵֽעֲךָ֨ ורעה [וְרֵ֪עַ] אָבִ֡יךָ אַֽל־תַּעֲזֹ֗ב וּבֵ֥ית אָחִ֗יךָ אַל־תָּ֭בוֹא בְּי֣וֹם אֵידֶ֑ךָ ט֥וֹב שָׁכֵ֥ן קָ֝ר֗וֹב מֵאָ֥ח רָחֽוֹק׃
Przyjaciela twego i przyjaciela ojca twego nie opuszczaj, a do domu brata twego nie wchodź w dzień nieszczęścia twojego. Lepszy sąsiad bliski, niżeli brat daleki.
Radak
וירא ה' אליו באלוני ממרא, in the location where Avraham dwelled, as we know from Genesis 14,13 והוא שוכן באלוני ממרא האמורי, “he dwelled by the groves of Mamre the Emorite. The reason why Avraham had not moved away from there was that his allies also lived in that proximity. Solomon advised already in Proverbs 27,10:טוב שכן קרוב מאח רחוק, “better a good neighbour who lives close by than a brother who lives far away.” G’d appeared to him there after he kept the commandment to circumcise himself, in order to apprise him of what he had in store for Sodom, a city in which his nephew had made his home. Avraham was the outstanding human being in that generation. Seeing that G’d was bent to exact partial retribution for the worst outrages committed by mankind at that time, He did not want to do so before informing Avraham of His intention. It was G’d’s intention to demonstrate that He does keep track of what individuals in the “lower” part of His universe are up to, and that He even will not exact collective punishment unless He can demonstrate that the parties affected are all guilty. There was no need for G’d to “descend” to investigate what He already knew, but the Torah describes this in terms that we can understand. He wanted to enable Avraham when the latter would instruct and teach his descendants to walk in the ways of G’d, to show that His ways were truly not only just but that He made allowances for human weaknesses. It is possible, -if this was indeed G’d’s purpose- to explain the entire paragraph as a prophetic vision up until verse 23 where the Torah writes that Avraham returned to his station, i.e. that this line terminated the prophetic vision יושב פתח האהל, as explained immediately following,
Rabbeinu Bahya
A Midrashic approach to Proverbs 25,17 (based on Rashi, Chagigah 7): On the one hand Solomon wrote הוקר רגלך מבית רעך, “visit your neighbor's house sparingly;” on the other hand David wrote in Psalms 66,13 :אבא ביתך בעולות, “I enter Your house with burnt-offerings.” The apparent contradiction is resolved by applying the “house” mentioned in Proverbs to the occasions when one has to offer sin-offerings or guilt-offerings. One should strive to minimize the need for such visits to the Temple. On the other hand, the verse in Psalms refers to the occasions when one approaches G’d bearing burnt-offerings and peace-offerings, i.e. voluntary gifts, not offerings in order to obtain atonement and forgiveness. The message of this Midrash is that both Solomon and David refer to the Holy Temple as “the house of your friend.” We find a similar comment by our sages when they said that the Israelites are called “friends” i.e. ריעים of the Lord, citing such verses as Psalms 122,8 למען אחי ורעי, “for the sake of my kin and friends...for the sake of the house of the Lord.” Solomon also says of G’d: רעך ורע אביך אל תעזוב, “do not abandon your friend or the friend of your father” (Proverbs 27,10), and in Song of Songs he speaks of זה דודי וזה רעי, “this is my beloved, and this is my friend” (Song of Songs 5,16). The thought behind all these verses is that a person should be careful not to sin so that he does not have to abuse his friendship with the Lord by entering His house too frequently in order to offer sin-offerings. It is best not to have to offer such offerings altogether.
We find that the prophet Samuel (Samuel I 16,22) expresses similar sentiments when he says: “it is better to listen to G’d’s commandments (observe them) than to offer meat-offerings to the Lord (in the Temple).” The reference was to the animals captured from the Amalekites. which the people and Saul offered to G’d as sacrifices, consuming their meat. When Solomon counseled not to be a frequent visitor in one’s friend’s house he referred to the House of G’d who should remain one’s “friend.” When Solomon wrote in Proverbs 21,27 that the meat-offerings of the wicked are an abomination, he meant that at the time when a wicked person brings an offering to G’d, G’d automatically thinks of his sins turning the entire procedure into an abomination. However, when the offerings are not connected to sin but are brought by righteous people and this is reflected in the kind of animals being offered, David tells us that such offerings are welcome, i.e. אבא ביתך בעולות, “let me enter Your house with burnt-offerings.” One of the temptations we must resist is taking advantage of having a “friend” in the house of G’d to whom we bring זבח i.e. meat-offerings, as if it were something “He” needs, until “He gets fed up” with these frequent unwelcome intrusions by us. When David speaks about bringing burnt-offerings to the Temple, he means offerings which are to atone for sins not actually committed but contemplated. Such sinful thoughts occur mostly at night, and they are difficult for a person to be saved from as there are no social restrictions to man thinking sinful thoughts. He is not found out and his image with his peers is not affected by what he merely thinks about. This is one of the reasons that the time for bringing such an offering is the night when the sin is still fresh and can be forgiven immediately.
We find that the prophet Samuel (Samuel I 16,22) expresses similar sentiments when he says: “it is better to listen to G’d’s commandments (observe them) than to offer meat-offerings to the Lord (in the Temple).” The reference was to the animals captured from the Amalekites. which the people and Saul offered to G’d as sacrifices, consuming their meat. When Solomon counseled not to be a frequent visitor in one’s friend’s house he referred to the House of G’d who should remain one’s “friend.” When Solomon wrote in Proverbs 21,27 that the meat-offerings of the wicked are an abomination, he meant that at the time when a wicked person brings an offering to G’d, G’d automatically thinks of his sins turning the entire procedure into an abomination. However, when the offerings are not connected to sin but are brought by righteous people and this is reflected in the kind of animals being offered, David tells us that such offerings are welcome, i.e. אבא ביתך בעולות, “let me enter Your house with burnt-offerings.” One of the temptations we must resist is taking advantage of having a “friend” in the house of G’d to whom we bring זבח i.e. meat-offerings, as if it were something “He” needs, until “He gets fed up” with these frequent unwelcome intrusions by us. When David speaks about bringing burnt-offerings to the Temple, he means offerings which are to atone for sins not actually committed but contemplated. Such sinful thoughts occur mostly at night, and they are difficult for a person to be saved from as there are no social restrictions to man thinking sinful thoughts. He is not found out and his image with his peers is not affected by what he merely thinks about. This is one of the reasons that the time for bringing such an offering is the night when the sin is still fresh and can be forgiven immediately.
Rashi
That which is hateful to you, do not do to your fellow: "Do not forsake your friend or your father's friend" (Proverbs 27:10) - this [refers to] the Holy One, blessed be He. Do not violate His words, for it is hateful unto you when a friend violates your words. Another [explanation]: Your fellow, literally - such as [with] robbery, theft, kidnapping, adultery, and most of the commandments.
Rashi
Join together Heb. (רֹעוּ), an expression similar to (Prov. 27:10): “Your friend and your father’s friend (רֵעֲךָ וְרֵעַ אָבִיךָ), as Jonathan renders: Join together. Join together, armies of Sennacherib.