The market town Gangkofen was a separate lower administrative and judicial unit ("Pflegamt") prior to 1803 and was part of the tax district ("") Landshut of the Prince-Electoriate Bavaria. The residence of the Teutonic Knights ("Kommende"), which was equipped with the liberties of a gentry seat ("Hofmarksrecht") and exercised the judicial stewardship over its own properties, was dissolved by the Kingdom of Bavaria in 1806. Additionally, Gangkofen was seat of a market court. In the process of administrative reforms in Bavaria, the municipality edict ("Gemeindeedikt") of 1818 and the territory reforms of the 1970s established the contemporary municipality.