A wide variety of methods make the chemicals in fungi that humans use as medicinal drugs. The fungi use the substances in their daily life. Fortunately, they can be used as a disease treatment in humans as well.
Cyclosporine is one medicinal chemical in fungi. It's a peptide made by joining amino acids together. The form of lovastatin that's used as a medicine is a lactone and is produced by a different method. Penicillin has a different structure from either lovastatin or cyclosporine, and is made by yet another method.