The Reinheitsgebot came out of Bavaria in the 1400s, but Germany wasn’t a unified country at that time. As Bavaria grew, the law grew as well to its areas. Still, until recently (1880s and later) it applied only to the areas that were in that zone.
Still there were so many exceptions that it really didn’t mean as much as we today believe it did. I can’t remember some of the history I learned from a German beer tour, but as other regions became a part of the unified country, there were exceptions made for wheat beers, top fermented beers, spice beers like wits, etc.