Law of Purchasing from a Non-Jew's Store Without Payment
Question
Answer
If the initial intention was to take without paying, one must return and pay. However, if the initial intention was to pay and one forgot, they are exempt from paying, provided there is no concern of desecrating the name.
Source
It is forbidden to steal from a non-Jew, as explained in Bava Kamma 113, and as ruled by the Shulchan Aruch, Siman 348, Se'if 2: "Anyone who steals even the value of a prutah transgresses the prohibition of 'do not steal' and is obligated to repay, whether stealing from a Jew or a non-Jew, and whether stealing from an adult or a child."
However, a non-Jew's error is permitted, as the Rema writes there: "A non-Jew's error, such as misleading him in calculation or annulling his loan, is permitted, provided he does not find out, to avoid desecrating the name. (Tur, Se'if 3) And some say it is forbidden to mislead him, but if he erred by himself, it is permitted. (Mordechai, Perek 'Gozel Batra').
And if the intention was to pay but one forgot, without intending to steal, it is considered his error, and according to the first opinion in the Rema, one is exempt from paying.