Sassafras and Safrole
Sassafras is a type of tree. It was used to make root beer and various foods and medicines. Sassafras contains safrole, which has been banned as a flavoring substance in the United States since 1960. According to Wikipedia [link], "Most commercial root beers have replaced the sassafras extract with methyl salicylate, the ester found in wintergreen and black birch (Betula lenta) bark."
Safrole is also found in nutmeg, cinnamon, anise, black pepper, and basil; and is used to make MDMA.
In the United States, safrole is prohibited for food use per the Code of Federal Regulations. [link]
This is to advise you that effective November 30, 1960, the Food and Drug Administration of the Department of Health, Education, and Welfare has refused to authorize the use in food of safrole, oil of sassafras, dihydrosafrole, and iso-safrole.
Laboratory studies by the Food and Drug Administration demonstrated safrole, which is also the principal component of oil of sassafras, to be a carcinogen, and dihydrosafrole and iso-safrole to cause liver damage to test animals.
Oil of sassafras is on the “Substances Generally Prohibited From Direct Addition or Use as Human Food” list [link].
The second line above links to this page [link], which states that safrole-free extract of sassafras may be used in food products.
The TTB, which directs use of alcohol products, specifies that sassafras leaves may be used in beverages if they are safrole-free. [link]
Sarsaparilla is allowed as a flavor additive in the United States. [link]
Some home brewers are using sassafras bark in home brewed root beer. Some sassafras bark products are available for sale but marked "not for food use" (some with indications of use in witchcraft).
The oil/bark was banned in food in the US in 1960 after it was shown to be carcinogenic in rats. Its cancerous nature in humans seems less certain, but regardless it’s not legal and on the “Substances Generally Prohibited From Direct Addition or Use as Human Food” list.
"Homemade Root Beer (Emphasis on the Root)" The Atlantic [link]