Some coffee does contain mold which is a safe type of mold.
The type of mold that some coffee beans contain is called Mycotoxins.
The small amount of Mycotoxin mold is found in some coffee beans but not all and it's not harmful to consume those Mycotoxin molds.
Coffee also has the ability to mold after it's been brewed if there are the right conditions for it.
For example if you left a cup or a pot of coffee out that has become cold and it sat for a few days then the coffee can and will likely mold.
In that case if the coffee has mold in it then you would not want to drink the moldy coffee.
But the mold in the coffee beans is okay to drink.
Most coffee does not contain any mold though but some does.