[כא:כז] וַיִּקַּח אַבְרָהָם צֹאן וּבָקָר וַיִּתֵּן לַֽאֲבִימֶלֶךְ וַיִּכְרְתוּ שְׁנֵיהֶם בְּרִֽית:
For many years I was bothered by why Avraham gave gifts to Avimelech instead of the other way around. After all, Avimelech had come to Avraham to ask for a peace treaty. It seems that Avraham inexplicably forfeited the upper hand and set a bad precedent for future generations (“מעשה אבות סימן לבנים”), but this conclusion is very difficult to accept. One simply cannot attribute such folly to the father of our nation, even if his descendants are tragically guilty of it to present times.
A: The Gemara in Nedarim 24A provides an illuminating perspective on this story. We learn there about certain types of nedarim [vows] that can be released without the usually required heter [absolution] of a chacham. One example is if someone says the following to his fellow: “You are forbidden by vow to benefit from me if you don’t take from me a gift for your son.” The motivation for this is not monetary considerations per se, but that the one making the vow is impressing the point that he “is not a dog who only takes but does not give in return”.
Similarly, one might say to his fellow: “You are forbidden by vow to benefit from me if you don’t GIVE a gift to my son.” In this case he is impressing the point that he “is not a king who only gives but does not receive in return”.
Back to the episode with Avraham and Avimelech. By having Avimelech come to him and leave with a gift – a flock of animals to shepherd home, no less – Avraham was very much assuming the role of king, for whom giving to others and receiving nothing in return is the ultimate expression of superiority.
[Note: Chazal are critical of Avraham for making a treaty with Avimelech altogether, and for giving him animals, and link both to his descendants suffering at the hands of the Pelishtim in future generations. See Midrash Shmuel 6:1, cited by Rashbam on 22:1, and Eliyahu Rabba 7:19. I am simply offering a Talmudic rationalization for Avraham offering the gifts, which does not conflict with the Midrash.]