Where the spell gets tricky is if people try to leverage real-world chemistry into it. For instance, transforming a few cubic feet of graphite into the world's largest diamond - after all, it's the same material.
Find a field of hemp plants, poppy flowers, etc. and become a drug lord
What is the conversion rate here, mass wise? I've always wondered how much coal or graphite it would take to make a diamond. Aren't diamonds more dense?
The spell states that "the quality of objects made by the spell is commensurate with the quality of the raw materials." Since graphite is a much poorer quality substance than diamond, I don't think that would work. That, and since tool proficiencies are required to create anything that requires a high degree of craftsmanship, I think it's reasonable to conclude that the spell can only create things that a human being using medieval tools could produce.
but on the other hand, diamond would make absolutely useless pencils.
Graphite is cheaper than diamond, certainly, but poorer quality? That doesn't follow. Both are composed entirely of pure carbon - the only difference is that in diamond, the carbon atoms are arranged in interlocking tetrahedra, whilst in graphite the atoms are arranged in layered flat sheets.
Graphite performs very poorly compared to diamond at being hard, clear and glittery, but on the other hand, diamond would make absolutely useless pencils.
And that's assuming that real-world chemistry even applies in a D&D world...