(Note: All sources were found and learned through the Sefer Mareh Kohen on Hilchos Niddah)
Eating together, per the Rosh, is something that engenders closeness between the couple, and during the days of Niddah, certain actions are prohibited in order to limit the closeness between the couple. This specific Harchokah seems to be unique in the sense that, according to some opinions, once the couple are no longer eating alone, the Harchokah no longer applies (this seems to be, for lack of a better word, a 'subjective' application by the Poskim of what is considered 'engendering closeness').
It seems to be that regarding this Harchokah, some Poskim have concluded that having other people around lowers the amount of 'Kurvah' of the action to permit it. Note that by the Harchokah of sitting on a swinging bench, the Rama also says that having someone sit between them removes the Harchokah.
Regarding the reason why handing an item in public is different:
The Machzor Vitri brings down that Rashi was careful to not hand anything to his wife during Niddah, although no reason is given in that work. In later works, two reasons were given: The Bais Yosef says that the reason was to avoid accidentally touching his wife, while the Rashba gave the reason as it engenders a feeling a closeness between the husband and wife (note: @mevaqesh noted that the Rashba in Toras Habayis (7:2) gives the reason as preventing touching. Unfortunately, the Mareh Kohen does not source where the Rashba says this opinion, although he does attribute it to the Rashba).
The Shulchan Aruch (as it was written by the Bais Yosef), brings down the reason of accidental touching as the reason for this Harchokah. As a result, this Harchokah would apply in all scenarios, regardless of who is around at the time. This also seems to be the accepted reason for this Harchokah.
Interestingly, even if you held that the reason was according to the Rashba, you might still not be allowed to hand an item directly to your wife who is a Niddah in a public setting. With regards to eating at the same table with your wife who is a Niddah, the Rashba is the most stringent of opinions, and holds that even if people are sitting between the couple, a Heker is still needed on the table. It may be a case of conflicting opinions for one to hold like the Rashba for handing items, but not for sitting at a table without a Heker (although that is quite debatable).