The Mechaber discusses the rule of dina demalchuta dina and its practical force in monetary and governmental matters. This is a central code source for the legal standing of government-imposed taxes.
בד"א שהמוכס כלסטים בזמן שהמוכס עכו"ם או מוכס העומד מאליו או מוכס העומד מחמת המלך ואין לו קצבה אלא לוקח מה שירצה אבל מוכס שפסקו המלך ליטול דבר קצוב (ואפי' צוה שישראל יתן יותר מעכו"ם מ"מ מקרי דבר קצוב לכל איש) (מהרי"ק שורש קצ"ד) והעמיד מוכס ישראל לגבותו למלך ונודע שאדם זה נאמן ואינו מוסיף כלום על מה שגזר המלך אינו בחזקת גזלן משום דדינא דמלכותא דינא ולא עוד אלא שהמבריח ממכס זה עובר (על לא תגזול) מפני שהוא גוזל מנת המלך בין שהיה מלך ישראל בין שהיה מלך עכו"ם וכן אם ישראל קנה המכס מהמלך המבריח עצמו הרי זה גוזל ישראל שקנאו (וי"א דאפי' ידוע דהישראל לוקח יותר מן הקצבה מ"מ אסור להבריח ממנו דבר הקצוב דהוי כגוזל מן הגזלן דאסור) (ב"י) אבל אם קנאו עכו"ם מותר משום דהוי כהפקע' הלוואתו דשרי במקום דליכא חלול השם: הגה וי"א דאפי' המוכס ישראל אם לא קנאו לעצמו רק גובה למלך אע"ג דאסור להבריח מכח דינא דמלכותא מ"מ אם אדם מבריח אין למוכס לכוף אותו ליתן דהוי כהפקעת הלוואתו דשרי מיהו אם יש בזה משום יראת המלך ודאי יכול לכוף אותו (ר"ן פ"ד דנדרים): וכן מלך ששם מס על בני העיר או על כל איש ואיש דבר קצוב משנה לשנה או על כל שדה ושדה דבר קצוב או שגזר שכל מי שיעבור על דבר זה ילקחו כל נכסיו לבית המלך או כל מי שימצא בשדה בשעת הגורן הוא יתן המס שעליה בין שהיה הוא בעל השדה בין שאינו בעל השדה וכל כיוצא בדברים אלו אינו גזל וישראל שגבה אותם למלך אינו בחזקת גזלן והרי הוא כשר והוא שלא יוסיף ולא ישנה ולא יקח לעצמו כלום:
Paragraph 6- When is it true that a tax collector is like a bandit? Where the tax collector is a gentile, he created the tax on his own or the tax is from the king but has no set amount and he can take what he wants. If the tax was set by the king and was a set amount, however- even if the king instructed that the Jew give more than the gentile, it is still considered a set amount for each person- and the king appointed a Jewish collector to collect for him and this person is known as trustworthy and would not add anything to what the king instructed, he is not presumed to be a robber because the law of the government is the law. Moreover, one who evades the tax violates “do not steal” because he has stolen the king’s gift, whether the king was Jewish or a gentile. Similarly, if a Jew acquired the tax from the king, if one evades the tax he is robbing the Jew who acquired the rights to it. There are those who say that even where it is known that the Jew takes more than the set amount, one is still prohibited from evading the set amount, because it is like he is robbing a robber, which is prohibited. If a gentile acquired the tax, however, one is permitted to evade because it is like evading a loan which is permissible where there is no desecration of God’s name. There are those who say that even if the tax collector is Jewish, if he did not acquire for himself and just collects on behalf of the king, although one is prohibited from evading because of the government law, if a person were to evade the collector cannot force him to give because is like evading a loan, which is permissible. If there is any concern that he is afraid of the king, however, he is certainly able to force him to give. Paragraph 7- Similarly, if a king placed a tax on the residents of a city or a set an annual tax on each individual or each field, or if he decreed that if anyone violates a certain matter then all his properties will be given to the king or that anyone discovered in a field during the threshing seasons must pay a tax, regardless of whether he owns the field or not, or anything similar, there is no issue of robbery and a Jew who collects such taxes for the king is not presumed to be a robber and is in good standing. This assumes he does not add, deviate or take anything for himself.