It was sometimes one of the ingredients in gruit, traditionally used in beers as a flavouring, until replaced by hops in the 11th to 16th centuries (for example, the Bavarian Purity Law of 1516 outlawed ingredients other than barley, hops, yeast, and water).
Medieval brewers had used many problematic ingredients to preserve beers, including soot and fly agaric mushrooms.
For instance Germany required the production of beer to adhere to its purity law.