The legend of Camembert is one of daring escape and dairy espionage.

The cheese was invented in 1791 when a priest from Brie (yes, like the cheese), took shelter with a dairymaid, Marie Harel, as he fled France’s anticlerical government. He taught her to make cheese with an edible rind, as local lore tells it. But the lesser known character in Ms. Harel’s story is a mysterious mold that resided in Normandy.

Penicillium appears in the wild as a toxic blue fungus, but in Camembert, Brie and other French regional cheeses, it is white and edible. For centuries, cheesemakers didn’t know how it evolved from its untamed to its domesticated forms. In a study published Tuesday in mBio that could be good news for American cheese lovers, researchers offer the first detailed view of how a fungus transforms into a mold safe for food production in as few as four weeks.

“We saw in real time how the fungi could change their metabolism in a way that would be advantageous for cheesemakers,” said Benjamin Wolfe, an assisstant professor of microbiology at Tufts University and the study’s principal investigator. He said the research could ultimately lead to “a diverse new approach to making cheese in the United States.”

The name Camembert isn’t restricted to cheese produced in Normandy, in contrast to Champagne, which comes from only one region of France. But a special designation is reserved for cheeses produced with unpasteurized milk from French cows. And the specialness of that cheese is derived in part from the fungus that naturally evolves into mold in cheese caves across northern France.