The gemara says that when non-jews gives tzedaka it serves as an atonement for them. Because it serves as an atonement, R' Ami refused to accept tzedaka from Ifra Hurmiz. Even Rava only accepted it because of shalom malchus, but otherwise would not have accepted it based on the pasuk - ביבש קצירה תשברנה which means that the goyim won't be destroyed until their zechuyos dry up, therefore we don't give them opportunities for zechuyos. However, the gemara says that if we were to use the funds to support non-jewish causes (which rashi explains that we support anyway for darkei shalom), it would not give them any special merit. It is only if we use the funds to support Jews that it is considered a zechus for them (but when it must be accepted for shalom malchus and it is ear marked for Jews, it is assur to use it for goyim as rashi explains because of geneivas da'as of the giver).
Tosafos 8a (d.h. yasiv) points out that the gemara in eruchin 6b implies that we would accept donations to shuls that come from goyim, why? Tosafos explains that donations to shuls are considered like korbanos and we do accept korbanos from goyim. The hagahos ashri raises the question, why is it that we don't accept tzedaka from goyim, but we do accept donation to shuls (and to the beis hamikdash) from them? The Hagahos Ashri answers that nedarim and nedavos that they are offering to the beis hamikdash are not for the purpose of atonement, that is why we can accept it from them.
What does the hagahos ashri mean that nedarim and nedavos are not meant for the purpose of kapara? What do the accomplish for the goyim aside from kapara? Furthermore, the gemara says in succah 55b that the goyim destroyed the beis hamikdash, not realizing what they will be losing. When we had the mikdash, the miz'beiach served as a kappara for them, but now they have nothing to atone for them. The gemara in Succah clearly implies that the purpose for their korbanos were to be a kappara, which contradicts the hagahos ashri?
The distinction of the Hagahos Ashri is found in the Shach and Taz (y.d. 254:4) to explain the Rama who says that we do accept donations to shuls from goyim, but don't accept tzedaka from them (unless the money was air marked for tzedaka and must be accepted for shalom malchus). Perhaps the gemara in succah is not referring to the nedarim and nedavos that the goyim bring, rather the beis hamikdash in general served as a kapara for the entire world, including the goyim. But the nedarim and nedavos, and donations to shuls that we accept to goyim is because it allows them to have a share in our tefillos, but won't serve as a kappara to prevent them from being destroyed for aveiros that they have committed. Tzedaka to the poor which would serve as a kapparah for aveiros that they have committed, we refuse to accept from them unless we have no choice (such as shalom malchus).
The Chochmas Adam (146:3) explains this idea a bit further:
ואם מנדבין דבר לבית הכנסת מקבלים מהם דהוי כמו קרבן ומקבלין נדרים ונדבות מעכו"ם, משא"כ צדקה דהוי כקרבן הבא על חטא דכתיב "חטאיך בצדקה פרוק" וקרבנות אלו אין מקבלים מן העכו"ם
Tzedaka to the poor is tantamount to a korban chatas which we don't accept from goyim because we don't give them opportunity for kappara, but donation offerings we do accept from them so we can also accept gifts to shuls.
It would seem that the issur of ביבש קצירה תשברנה which forbids accepting tzedaka from them only applies to tzedaka to the poor, but donations to yeshivos and donations for gemilas chessed which doesn't go to the poor would be like nedarim and nedavos and donations to shuls that we can accept from them. But perhaps when it comes to talmud torah, since the donation buys them a share in the torah, we should not provide them with that opportunity either?