Here are the excerpts from the relevant portions of Talmud Bavra Basa 10b:
Rabban Johanan b. Zakkai said to his disciples: My sons, what is the meaning of the verse, Righteousness exalteth a nation, but the kindness of the peoples is sin?
R. Eliezer answered and said: 'Righteousness exalteth a nation:' this refers to Israel of whom it is written, Who is like thy people Israel one nation in the earth? But 'the kindness of the peoples is sin': all the charity and kindness done by the heathen is counted to them as sin, because they only do it to magnify themselves, as it says, That they may offer sacrifices of sweet savor unto the God of heaven, and pray for the life of the king and of his sons. But is not an act of this kind charity in the full sense of the word, seeing that it has been taught: 'If a man says, — I give this sela for charity in order that my sons may live and that I may be found worthy of the future world, he may all the same be a righteous man in the full sense of the word'? — There is no contradiction; in the one case we speak of an Israelite, in the other of a heathen.
R. Joshuah answered and said: 'Righteousness exalteth a nation,' this refers to Israel of whom it is written, Who is like thy people Israel, one nation on the earth? 'The kindness of peoples is sin': all the charity and kindness that the heathen do is counted sin to them, because they only do it in order that their dominion may be prolonged, as it says, Wherefore O king, let my counsel be acceptable to thee, and break off thy sins by righteousness, and thy iniquities by showing mercy to the poor, if there may be a lengthening of thy tranquility. Rabban Gamaliel answered Saying: 'Righteousness exalteth a nation': this refers to Israel of whom it is written, Who is like thy people Israel, etc. 'And the kindness of the peoples is sin:' all the charity and kindness that the heathen do is counted as sin to them, because they only do it to display haughtiness, and whoever displays haughtiness is cast into Gehinnom, as it says, The proud and haughty man, scorner is his name, he worketh in the wrath ['ebrah] of pride, and 'wrath' connotes Gehinnom, as it is written, A day of wrath is that day. Said Rabban Gamaliel: We have still to hear the opinion of the Modiite. R. Eliezer the Modiite says: 'Righteousness exalteth a nation': this refers to Israel of whom it is written, Who is like thy people Israel, one nation in the earth. 'The kindness of the peoples is sin': all the charity and kindness of the heathen is counted to them as sin, since they do it only to reproach us, as it says, The Lord hath brought it and done according as he spake, because ye have sinned against the Lord and have not obeyed his voice, therefore this thing is come upon you.R. Nehuniah b. ha-Kanah answered saying: 'Righteousness exalteth a nation, and there is kindness for Israel and a sin-offering for the peoples.' Said R. Johanan b. Zakkai to his disciples: 'The answer of R. Nehuniah b. ha-Kanah is superior to my answer and to yours, because he assigns charity and kindness to Israel and sin to the heathen.' This seems to show that he also gave an answer; what was it? — As it has been taught: R. Johanan b. Zakkai said to them: Just as the sin-offering makes atonement for Israel, so charity makes atonement for the heathen.