It is known that there is a contradiction in the Rambam [Maimonides] if we go by R. Shimon or the Sages.
And this came up in Bava Metzia but I never got there with my learning partner so I never learned that subject with any depth.
But I thought to at least lay out the basic subject for public information.
In Bava Metzia this comes up about the widow. לא תחבול בגד אלמנה"Thou shalt not take a garment of a widow as a pledge for a loan." R. Shimon] says if she is not poor you can take a pledge [because we go by the reason for the verse. Even though the verse don't take a pledge from a widow still we know the reason for this is because of compassion for her poor state. If she is not poor there is no reason not to take a pledge.] [Notice we do not say there is any mystical reason for the mitzvah. Even the sages agree that we know the reason for all the mitzvot except for just one. The only argument is if we go by the reason or by what is written.]
Here the Rambam goes with the Sages. But by the prohibition of marrying a woman that serves idols the Rambam goes by the reason and not by what is written.
I thought the Rambam had an idea of the reason modifying how we apply the mitzvah because of what he wrote in the commentary on the Mishna.
But then I saw Rav Shach [of the Ponovitch Yeshiva in Bnei Brak] wrote about the law in the Rambam about a city of idolaters on the border of Israel, that even Rabbi Shimon agrees that the only question is if the mitzvah applies in a certain situation or not. We never use the reason to modify the rules.
The law in the Rambam is Laws of Idolatry 4:4. A עיר הנדחת If a city of idolaters is on the border of Israel we don't destroy it so that the border should not be left open. That reason is to R Shimon. From this Rav Shach proves his point you don't modify the law based on the reason for the law.
The idea here is how you would apply the law here would be different if we went by the Sages--which we do. So the Rambam bringing the reason of RS is not meant to modify it.
[I have depended on RS even though he is not the halacha, because I consider my situation to be שעת הדחק emergency. We use the same logic for other things like new produce חדש. We say We can depend on R Eliezer in an emergency. This is even though clearly the halacha is not like him. This gives rise to the fact that I sometimes take any opinion mentioned in the Gemara as my rule. In fact I have used the Gemara as my personal code of law --ever since my entire situation became a state of extreme emergency. But because the world is messed up I thought I should tell others because there could be other people out there that also find themselves in situations that are hard and can't be as strict in law as perhaps we all should be. What makes my situation to be what I think is a emergency is the group of people that normally I would try be fit in with--the group that tries to keep the Torah-had been taken over by the Dark Side, the Sitra Achra, as is well known. So if I or anyone else wants to keep the Torah we have to do it on our own and and say as far as possible from those that make a display of keeping Torah. Hasidim work for the exact opposite of what they claim. In this world nothing is what it seems.]