  Tidal gravitational forces can modify the shape of galaxies and clusters of
galaxies, thus correlating their orientation with the surrounding matter
density field. We study the dependence of this phenomenon, known as intrinsic
alignment (IA), on the mass of the dark matter haloes that host these bright
structures, analysing the Millennium and Millennium-XXL $N$-body simulations.
We closely follow the observational approach, measuring the halo position-halo
shape alignment and subsequently dividing out the dependence on halo bias. We
derive a theoretical scaling of the IA amplitude with mass in a dark matter
universe, and predict a power-law with slope $\beta_{\mathrm{M}}$ in the range
$1/3$ to $1/2$, depending on mass scale. We find that the simulation data agree
with each other and with the theoretical prediction remarkably well over three
orders of magnitude in mass, with the joint analysis yielding an estimate of
$\beta_{\mathrm{M}} = 0.36^{+0.01}_{-0.01}$. This result does not depend on
redshift or on the details of the halo shape measurement. The analysis is
repeated on observational data, obtaining a significantly higher value,
$\beta_{\mathrm{M}} = 0.56^{+0.05}_{-0.05}$. There are also small but
significant deviations from our simple model in the simulation signals at both
the high- and low-mass end. We discuss possible reasons for these
discrepancies, and argue that they can be attributed to physical processes not
captured in the model or in the dark matter-only simulations.
