We present a new approach to the statistics of the cosmic density field and to the mass distribution of bound structures, based on the formalism of Cayley trees. Our approach includes in one random process both fluctuations and interactions of the density perturbations. We connect tree-related quantities, like the partition function or its generating function, to the mass distribution. The Press and Schechter mass function and the Smoluchowski kinetic equation are naturally recovered as two limiting cases, corresponding to independent Gaussian fluctuations and to aggregation of high-contrast condensations, respectively. Numerical realizations of the complete random process on the tree yield an excess of large-mass objects relative to the Press and Schechter function. When interactions are fully effective, a power-law distribution with logarithmic slope -2 is generated.