1.) To protect the colonized substrate from drying out. 2.) To provide a humid microclimate for primordia formation and development. 3.) To provide a water reservoir for the maturing mushrooms. 4.) To support the growth of fructification enhancing microorganisms. (TMC, p 128 -129)
The 1st(main) 3 elements all are ancillary manifestations to the substrate's requirement for water. Mushrooms are 90% water, and casing not only provides water, but seals it in and actually helps make the casing produce moisture on its own. Casing has gained a reputation for being "hard" for beginners, unfortunately. It is actually just one more step after the birth of the PF jars - the "crumble and case" step.
Newbies fear casing for a few reasons, none of which are flippant: 1.) Casings add another vector of possible contamination (several within the steps) as compared to PF and cakes. 2.) Casings require additional steps, which are not necessary to produce fruit. 3.) Casings put "all of your eggs in one basket" - casing containers often contain anywhere from 1 to 6 PF style cakes. If one casing is lost, the equivalent in PF cakes (and their productivity) is lost. 4.) Casings require more attention to the RH (relative humidity) than cakes do. Casings require alternating humidity levels, 95 -100% at the pinning stage, and around 90% at the fruiting stage, while cakes can remain and produce well at a stable 95% RH.
Casings can be better than straight cakes because: 1.) They produce larger flushes, both in terms of the size, weight, and gross/net harvest. 2.) They give the hobbyist a better understanding of the mushroom life cycle. Not only for psilocybes, but learning the basic life cycle can introduce the new hobbyist into the world of gourmet and medicinal mushrooms. 3.) Casings are often a "stepping -stone" into further, more discreet and sophisticated methods of mushroom production.