We study rings of integral modular forms for congruence subgroups as modules
over the ring of integral modular forms for the full modular group. In many
cases these modules are free or decompose at least into well-understood pieces.
We apply this to characterize which rings of modular forms are Cohen--Macaulay
and to prove finite generation results. These theorems are based on
decomposition results about vector bundles on the compactified moduli stack of
elliptic curves.Comment: Rewritten introduction, updated references. This article supersedes
the algebraic part of arXiv:1609.0926