The point of sound absorbing foams is that they a) have lots of air spaces and b) have angles that divert sound. The second part is relatively easy, but making sure to get consistent sound absorbing characteristics of the appropriate type of foam, along with the appropriate amount and size of air spaces and an acceptable level of durability does make it relatively costly to make.
Honestly, properly preparing a studio space can easily cost several grand in materials to do properly, so a couple hundred bucks is already pretty cheap. There are budget alternatives, but they aren't generally that much cheaper and can be more difficult and time consuming to work with.
Acoustic foam is a) relatively easy to work with, b) produces consistent results and c) is reasonably durable. That makes it worth the price in my opinion.
Heavy blankets and/or fiberglass can do the job too, but both have their own challenges. (Blankets can be pricy and heavy by the time you have enough of them, fiberglass is messy and can't be as easily removed.)