To pay someone back in his own coin/ retaliate/ recompensing
Punish him as he deserves (retribution means doing an act that is the consequence of a previous act that was done).
("Behold, I will raise them up from the place where you have sold them, and I will restore your ransom upon your own head" - Joel 4:7, and so: "Restore to the steward of the house his ransom upon his own head, for he has shed the blood of men" - Agnon/Sifurei HaBeshat, Haner)
Translation
Expression (Hebrew)
הֵשִׁיב גְּמוּלוֹ בְּרֹאשׁוֹ, הֵשִׁיב לוֹ כִּגְמוּלוֹ (הֲשָׁבַת גְּמוּל)
Definition (Hebrew)
הֶעֱנִישׁ אוֹתוֹ כְּמוֹ שֶׁמַּגִּיעַ לוֹ (גְּמוּל מַשְׁמָע עֲשִׂיַּת מַעֲשֶׂה תְּמוּרַת מַעֲשֶׂה קוֹדֵם שֶׁנַּעֲשָׂה).
("הִנְנִי מְעִירָם מִן הַמָּקוֹם אֲשֶׁר מְכַרְתֶּם אֹתָם שָׁמָּה וַהֲשִׁבֹתִי גְמֻלְכֶם בְּרֹאשְׁכֶם"- יוֹאֵל ד ז, וְכֵן:"הֵשִׁיבוּ לְסוֹכֵן הַבַּיִת גְּמוּלוֹ בְּרֹאשׁוֹ עַל אֲשֶׁר שָׁפַךְ דָּם הָאֲנָשִׁים "- עַגְנוֹן/ סִפּוּרֵי הַבֵּעשְׁ"ט, הַנֵּר)