It's easy to grow compared with cocaine. You can grow the plant in a tent or if need be just on your windowsill, pluck and trim it, dry it, then smoke it or bake it in an edible. And even a single plant is good for quite a number of joints. Hash oil extraction is more difficult but most stoners prefer to smoke pure or tobacco mix weed anyway.
Cocaine in contrast, you need 300-ish grams of leaves to make 1 gram of cocaine, and a ton of chemistry afterwards to extract and purify it.
For the level of processing involved, marijuana isn't that cheep when compared to any other bulk farming product. Hemp fiber for example is around $150 per ton. The markup is still very high comparatively for the drug product.
When you look at the production line of something like high fructose corn syurp, you could industrialize the process in to the range of $10000 per ton pretty easily.
Again, it's the black market that turns it into the million dollar range because of the risks involved.