Prohibition to drink beer in bars:
The gemara asks why beer of goyim is forbidden. However, the question doesn't stem from any statment, rather the question compels the assumption that it is actually forbidden. The gemara says that it is assur either because of leading to intermarriage or because they leave the water uncovered. Yet, the gemara says that the opinions who forbid beer due to intermarriage, permit it when taken out of the bar, store or home of the goy. Bishul Akum is also prohibited dues to intermarriage, yet we don't find any leniency of take out - why? Tosafos points out that we don't find this prohibition in any Tanaic source, so it must have been an issur first introduced by the amoraim. It seems that the amoraim created an issur to prevent intermarriage similar to the earlier prohibition (i.e. bishul akum and pas akum), but weren't quite as strict in their prohibition and permitted it to be taken home [Taz (114:2) offers other reasons why we are more machmir with bread than beer]. Tosafos goes one step further and justifies the practice of drinking beer when travelling and staying over in an inn of a goy by suggesting that it was only assur if done with some form of regularity, or in a place established for drinking such as a bar, but not when done באקראי בעלמא. All this is codified by the shulchan aruch 114:1.
Bishul Akum on Beer and Coffee:
Another issue that Tosafos raises - why isn't beer forbidden as bishul akum? Tosafos answers: 1. It isn't fit for a kings table. 2. Just like for the bracha we consider it batul to the water and make shehakol, it is also batul for the purpose of bishul akum. The second answer of Tosafos is cited by the Shach (114:1), Taz and even Gr"a (3). The problem is that Tosafos in Brachos 38a asks why we don't make mezonos on beer that is made with barley. Tosafos answers: 1. there is no actual barley in the water, just the taste of barley. 2. since they have a more ideal use i.e. bread, it is only shehakol when not eaten as they are meant to be eaten. 3. drinks are always shehakol. Howe can Tosafos by us say that we make shehakol on beer because it is batul to the water (and uses this as a source that there wouldn't be bishul akum), since Tosafos in Brachos offers 3 other answers as to why we make shehakol? It seems to me that the first answer in brachos is really the same explanation as Tosafos is offering by us. Since there is not actual barley in the water, just the taste of barley, it isn't considered chashuv and is batul to the water. Even though Tosafos in Brachos seems to hold that the last answer is the primary one (it is repeated at the end of the page), it is not meant to reject the first answer since that would undermine the heter of bishul akum.
Now, is coffee a problem of bishul akum? Pischei Teshuva (114:1) cites pri chadash that the same heter we have for bishul akum by beer would apply to coffee. The panim me'iros disagrees because he understands that the primary heter for beer is that it isn't fit for a kings table, which is not the case by coffee. Based on this he holds that coffee cannot be purchased from goyim. The Yad Ephraim explains (in the name of pri chadash) that the heter of not being fit for a kings table is applicable to coffee as well because the rule is actually - כל שאינו עולה על שולחן מלכים ללפת בו את הפת, meaning that even if fit it is served at a kings table, since it doesn't enhance the bread it is not included in the prohibition of bishul akum.