Our Gemara on Amud Aleph describes a situation where Rabban Shimon ben Gamliel fought against a situation of price gouging. There was a shortage of sacrificial doves necessary for new mothers to bring as an offering to complete their purification process which led to a price spike. Fearing this would cause people despair and possibly to give up on the whole ritual, he enacted an emergency measure, allowing certain sacrifices to double up even though they ordinarily should be separate obligations. This is an example of many situations where the rabbis enacted consumer and marketplace protections. There is a fascinating responsa reflecting a more modern application of this idea.
The Shu”t Tzemach Tzedek (28) discusses a situation where there was price gouging on fish, targeted toward the Jews on Friday who have a custom of buying fish in honor of Shabbos. The question is, is it permitted to adopt a temporary community ban on fish, which in the short term would disrupt the custom and degrade the quality of Shabbos in the long-term interest of putting the merchants in their place, so that the price exploitation would discontinue. While the specificity of fish might be merely a custom, the Tzemach Tzedek was of the opinion that the overall concept of honoring Shabbos had the authority of a Biblical command. Therefore, he was concerned that for financial matters, it might be inappropriate to disrupt a Torah law.
Another interesting wrinkle is that it also could become a de facto test of faith. The Talmud (Beitzah 15b) seems to promise that one should not need to budget or worry about expenses when it comes to honoring the Shabbos. It states:
My children, borrow on My account, and sanctify the sanctity of the day of Shabbos and the Festivals with wine, and trust in Me, and I will repay this debt.
(By the way, this is the meaning of the lovely Shabbos Zemer, “Ulevu Alay Banay”, possibly authored by Shlomo ibn Gebirol. In the song, Hashem is asking the Jews to borrow on his account and enjoy the delights of Shabbos.)
However, there is a different teaching which seems to contradict what it says in above. Shabbos (112a) says that one should even let his Shabbos be conducted as a weekday in order to avoid burdening others with providing charity. (In terms of quality of food, but obviously not to violate the Shabbos by working.)
The Tzemach Tzedek answers this contradiction by making a distinction between somebody who has the funds versus somebody who does not. So long as one has the funds, money can be laid out. On the other hand, someone who does not have the money should do without, even if it means a simple meal, and not be a burden on others. He therefore says the function of this boycott would be to protect the impoverished consumers, who cannot afford the fish and should not borrow either, therefore there’s a legitimate argument for enacting a ban.
What about a situation where somebody does not have the money but has a way to borrow it? Some might say this was included in what the first Gemara stated, that God assures He will pay back any money borrowed on behalf of Shabbos. However, this is not definitely indicated because perhaps it only means a metaphoric loan. That is, God says, spend the money now even if ordinarily you wouldn’t spend it because you are worried that you’ll need it later, – and don’t worry, I will pay you back. But it still might be referring only to funds that a person has, as opposed to a person who does not have money at all. In that case, it might be wrong to borrow money, and instead the dictum of the second teaching should apply.
Tosafos (“Levu”, Beitzah ibid, especially according to the interpretation of Chochmas Shelomo ibid) takes a middle view. Somebody who does not have funds should not rely on this promise, and instead treat his Shabbos like a weekday if need be. However, somebody who has the assets, even if they aren’t liquid and even if it’s a stretch, should borrow the money and use the assets as a security because God promises he will find a way that the person will be able to pay back the loan without losing the assets. In other words, somebody who really based on their budget cannot actually afford it, but technically somehow could come up with the money still should appropriately assume that God will pay him back for the money he lays out to honor Shabbos. The second teaching about having a simple Shabbos with no extra food then a weekday meal is exclusively regarding a person who has no assets and is indigent.
A careful reading of the Tur (OC 242:1) and Kitzur (72:8) implies a stronger position than Tosafos. I believe they require most everyone to spend money on honoring the Shabbos, even to overextend somewhat if there’s no choice and to borrow money. The only exception that they seem to make is for someone who is “in an extremely oppressive situation.” They say, that person should economize and not spend money on Shabbos.
In any case, while there might be some disagreement about the definition of “extremely oppressive”, there does seem to be an overall consensus that there is some limit. Someone who is in abject poverty is not supposed to borrow money nor take charity to spend extra money for Shabbos. The question is, philosophically and theologically why should it matter? If God is promising to pay back for expenses, and I think it’s fair to assume that God is not on a tight budget, why can you not just as easily take care of the person who is completely indigent? “Is the hand of God limited?“ (Bamidbar 11:23).
I believe the answer is that if a person is in such extreme poverty, for whatever reason, this is a unique situation and part of some specific divine decree, whether it is a test or punishment, this person is simply not meant to have money. Given that this is the case, it is not appropriate to borrow money or overextend to honor Shabbos. This reveals a fascinating idea about how providence is evaluated from a Jewish philosophical perspective. It seems that there are times where even if generally one should expect support and provision from God, there could be particular reasons why it’s not an auspicious time to succeed. Judaism often offers common sense and practical approaches. One must work hard, have faith, and sometimes even extend himself for a valued principal, like honoring the Shabbos. At the same time, obviously destructive or foolish measures based on the person’s track record and general status, should be avoided, although this might be determined differently by different halachic authorities.