  This paper is built on the following observation: the purity of the mixed
Hodge structure on the cohomology of Brown's moduli spaces is essentially
equivalent to the freeness of the dihedral operad underlying the gravity
operad. We prove these two facts by relying on both the geometric and the
algebraic aspects of the problem: the complete geometric description of the
cohomology of Brown's moduli spaces and the coradical filtration of cofree
cooperads. This gives a conceptual proof of an identity of Bergstr\"om-Brown
which expresses the Betti numbers of Brown's moduli spaces via the inversion of
a generating series. This also generalizes the Salvatore-Tauraso theorem on the
nonsymmetric Lie operad.
