The Gemara teaches that we can learn the importance of offering food from the fact that the Torah prohibits marrying converts from two nations (Amon and Moav) because those nations did not offer food to the Jewish people when they passed their area in the Midbar.
The RAMBAN (in Devarim 23:5) proves from the verse (in Devarim 2:39) that Moav *did* provide food for the Jewish people (by selling it to them) when the Jews passed near them. The Ramban writes that it is not reasonable to suggest that the Torah would prohibit marrying a nation because they *sold* food instead of offering it as a gift. In addition, we find only that Moav hired Bil'am to curse the Jews, and not Amon. He concludes that the Jews are prohibited to marry someone from *Amon* (even though they did not hire Bil'am) because they did not provide us with food, and the Jews are prohibited to *Moav* (even though they did provide us with food) because they hired Bil'am. That is, the two reasons given in the verse (in Devarim 23:5) for the prohibition against marrying members of these nations do not apply to *both* nations; rather, one reason applies to each nation.
How does the Ramban understand our Gemara, which says that *both* nations were distanced because they did not provide us with food?
M. Kaplan, Har Nof
(a) This is an excellent question. An even more obvious question on the Ramban may be asked from the Gemara in Yevamos (76b), which says that Ruth was permitted to marry a Jew because only the men of Moav were expected to bring out food to the Jewish people, and not the women. The Gemara there asks that the women should have brought food to provide for the Jewish women, and since they did not do so they should be prohibited. The Gemara answers that it is still, nevertheless, the proper manner of women to be modest and not go out. It is clear from that Gemara that the Moavim are being distanced for the sin of not providing food, and not just because they hired Bil'am. If the only reason they are prohibited is because they hired Bil'am, then the Gemara should have concluded, as the Ramban himself does (citing the Yerushalmi in Yevamos 8:3 and Midrash Shmuel ch. 22), that it is the manner of men to hire and not the manner of women, and the Gemara would no longer have been able to question the Heter of marrying women from Moav because the issue does not involve bringing food.
Your question is asked by the MAHARSHA here, and the second question is asked by the RASHBA in Yevamos 76b. (The RASHBA answers that the Gemara means to prove from *Amon* that women women were prohibited, and if so it stands to reason that the women of Moav were prohibited as well -- perhaps because they did not stop their husbands from plotting against the Jews. This, of course, does not begin to answer the question from Sanhedrin. See also RITVA there.) Indeed, the KESAV V'KABALAH on this verse rejects the Ramban's explanation because of these two questions from Sanhedrin and Yevamos.
(b) An additional question may be asked on the Ramban from the very Yerushalmi that he quotes. The Yerushalmi, when it asks the question that the women of Moav should have brought food to the Jewish women, answers that it is not the manner of women *to hire*. It is clear from the Yerushalmi itself that the prohibition of marrying men from Moav is based on *two* factors -- first, they did not bring food, and second, they hired Bil'am. When either of these factors are missing (for example, in the case of women of Moav, since women do not hire), the prohibition does not apply. How, then, can the Ramban say that the Moavim are prohibited only because they hired Bil'am?
(I noticed, though, that the TZIYON YERUSHALAYIM offers a different explanation for the words of the Yerushalmi there, according to which the Yerushalayim is saying that *neither* of the two reasons applies to Moav.)
Furthermore, the verse itself implies that both reasons apply to both nations, for, otherwise, why would the verse group together two Isurim that are based on two unrelated causes? The verse should separate them, the same way that it separates the Isur of Mitzri and the Isur of Edomi (Devarim 23:8)!
(I suppose one might answer that both were distanced because they did not show gratitude to the descendants of Avraham -- in whose merit they survived the destruction of Sedom -- albeit their ingratitude was expressed in different ways.)
(c) I therefore would suggest to explain the Ramban as follows: Amon and Moav were sister nations and always advised with each other. Moav would not have hired Bil'am without first receiving the consent of Amon. Amon would not have refused to feed the Jews without first receiving the consent of Moav. Therefore, although the primary cause for prohibiting Moav was that they hired Bil'am, the Torah only prohibits them because they *also* played a minor role in Amon's refusal to feed the Jews. Similarly, Amon was prohibited mainly because they did not feed the Jews, but only in combination with the fact that they consented to Moav's hiring of Bil'am. If so, there indeed were two reasons for distancing the nation of Moav.
(I found that Hagaon Rav Aharon Yafhen, in his notes on the RITVA to Yevamos 76b (note #592), suggested that the Bavli and Yerushalmi might be arguing over the Ramban's interpretation of the verse, see his note there at length.)