I'm a non-Jew, so please forgive me if I have erred regarding anything here, or accidentally omitted anything which ruins my point, or overlooked these points in the answers to other similar questions.
The Gemara compares a gentile studying Torah to adultery or theft. But these can only be true if the gentile (even if we assume gentile means all non-Jews) is taking the Torah for his own, ie. depriving Its rightful owners. A non-Jewish believer of G-d that accepts that the Torah isn't his, and who studies it for non-selfish reasons has committed no theft. He has done nothing to erode the Jewish connection to the Torah (and perhaps his adoration strengthens the Jewish connection, for perception is dependent on the views of one's company). One may appreciate the possession of one's superior without having committed theft. This is also what the same Gemara suggests later:
"The Gemara raises an objection to Rabbi Yoḥanan’s statement from a baraita: Rabbi Meir would say: From where is it derived that even a gentile who engages in Torah study is considered like a High Priest? It is derived from that which is stated: “You shall therefore keep My statutes and My ordinances, which if a man does he shall live by them” (Leviticus 18:5)... The Gemara answers: There, in the baraita, the reference is to a gentile who engages in the study of their seven mitzvot. It is a mitzva for a gentile to study the halakhot that pertain to the seven Noahide mitzvot, and when he does so he is highly regarded."
Rabbi Meir's objection and the Gemara's reconciliation of that objection forces us to adopt a particular meaning of "study." As a non-Jew who learns of the Noahide Laws and doesn't keep them cannot be called a High Priest (per Rabbi Meir's quoted definition), so a non-Jew who studies Torah but doesn't adopt any Mitzva that doesn't apply to him cannot run afoul of the Gemara's prohibition. He is not "studying" by the Gemara's definition of "studying" (as that definition appears to me in the text anyway).
This is the exact manner that both the RAMBAM and R. Yechiel Yaakov Weinberg (quoted by Alex in his answer to this question) interpret it, and therefore there is no contradiction with the Gemara. Furthermore, it seems this is the only way to reconcile this Gemara with a commonly (though perhaps not exclusively) given purpose of exile: converts (Gemara Pesachim 87b, explained by Yaaros Dvash (r'Yonasan Eibeshitz) 8,16). If Torah cannot be taught to any non-Jew, then all converts are impossible, unless they decide to convert while still blind to the Torah and their future obligations, which I know no orthodox Rabbi would tolerate.
So by this analysis of the Gemara, the parameters of the prohibition against a non-Jew studying Torah only concern study for the sake of performing a Mitzva beyond the non-Jews seven Mitzvot.
ואמר ר' יוחנן עובד כוכבים שעוסק בתורה חייב מיתה שנאמר (דברים לג, ד) תורה צוה לנו משה מורשה לנו מורשה ולא להם וליחשבה גבי שבע מצות מ"ד מורשה מיגזל קא גזיל לה מאן דאמר מאורסה דינו כנערה המאורסה דבסקילה מיתיבי היה ר"מ אומר מניין שאפילו עובד כוכבים ועוסק בתורה שהוא ככהן גדול שנאמר (ויקרא יח, ה) אשר יעשה אותם האדם וחי בהם כהנים לוים וישראלים לא נאמר אלא האדם הא למדת שאפילו עובד כוכבים ועוסק בתורה הרי הוא ככהן גדול התם בשבע מצות דידהו:
Sanhedrin 59a:
"And Rabbi Yoḥanan says: A gentile who engages in Torah study is liable to receive the death penalty; as it is stated: “Moses commanded us a law [Torah], an inheritance of the congregation of Jacob” (Deuteronomy 33:4), indicating that it is an inheritance for us, and not for them. The Gemara challenges: But if so, let the tanna count this prohibition among the seven Noahide mitzvot. The Gemara explains: According to the one who says that the verse is referring to the Torah as an inheritance, this prohibition is included in the prohibition of robbery, as a gentile who studies Torah robs the Jewish people of it. According to the one who says that the verse is referring to the Torah as betrothed, as the spelling of the Hebrew word for betrothed [me’orasa], is similar to that of the word for inheritance [morasha], the punishment of a gentile who studies Torah is like that of one who engages in intercourse with a betrothed young woman, which is execution by stoning. The Gemara raises an objection to Rabbi Yoḥanan’s statement from a baraita: Rabbi Meir would say: From where is it derived that even a gentile who engages in Torah study is considered like a High Priest? It is derived from that which is stated: “You shall therefore keep My statutes and My ordinances, which if a man does he shall live by them” (Leviticus 18:5). The phrase: Which if priests, Levites, and Israelites do they shall live by them, is not stated, but rather: “A man,” which indicates mankind in general. You have therefore learned that even a gentile who engages in Torah study is considered like a High Priest. The Gemara answers: There, in the baraita, the reference is to a gentile who engages in the study of their seven mitzvot. It is a mitzva for a gentile to study the halakhot that pertain to the seven Noahide mitzvot, and when he does so he is highly regarded."