The Rashba says that the bread receives its classification at the time of baking, because this is the form in which Chazal defined the gezeirah (decree). So if the bread was made by a palter, it receives the status of pas palter and keeps this status going forward. The Ra'ah holds that the bread goes after the situation that you find yourself in right now. The Ra'ah holds that the reason for the gezeirah of pas akum was to prevent inappropriate kiruv hada'as (friendly bonding). So it doesn't matter who made the bread; it matters who is giving it to you right now. If he is a baal habayis then there is kiruv hada'as, and the bread would be called pas baal habayis.
Let's examine how the Shulchan Aruch decides between these two opinions
In Y.D. 112:3 the Shulchan Aruch says: "There are those who say that if a non-Jewish palter invites a Jew to his house, his bread is regarded as pas baal habayis."
Given what we said above the Shulchan Aruch must be paskening (ruling) like the Ra'ah.
However, in Y.D. 112:7, the Shulchan Aruch says: "Pas baal habayis is always forbidden, even if a palter bought it from him, and even if the palter sent the bread to the Jew's house... Pas palter is always permissible, even if a baal habayis bought it from him...because when they created this gezeirah, they did not go after the one who has the bread now, but rather after the one who had the bread at the time of baking."
Clearly the Shulchan Aruch is paskening like the Rashba here.
So there is an apparent contradiction between how the Shulchan Aruch paskens in 112:3 and 112:7. How do we reconcile these two contradictory statements?
The Shach brings two solutions:
Solution #1. The Shulchan Aruch really paskens like the Rashba, who goes after the baking. He states this clearly in 112:7. The expression he uses in 112:3 is "There are those who say..." which implies that he does not necessarily pasken like this opinion but wants to bring it as a stringency over and above the basic halacha.
There is a difficulty here. If the Shulchan Aruch wanted to bring the two opinions, one as the basic halacha, and one as a stringency, he should have brought them in the same seif (paragraph). Why did he bring them in two separate seifim, and in the reverse order, stating the stringency first and then the basic halacha?
Solution #2. The Shulchan Aruch feels that the two scenarios in 112:3 and 112:7 are qualitatively different. 112:7 is a general case where the pas palter finds its way into a baal habayis' hands and the baal habayis has limited interaction with the Jew. However, in 112:3, where the baal habayis is inviting the Jew into his own home, the Shulchan Aruch sees this as a special scenario where there is a real danger of inappropriate friendly bonding and warrants ruling like the Ra'ah.
So in summary, the Shulchan Aruch paskens that we classify bread by what who owns it at the time of baking. However, there are certain more intimate situations where we need to guard ourselves and be strict like the Ra'ah.
A good Shabbos!