OK, I think I have figured it out. I believe this script/example has been floating around in our documentation for too many years, and at some point we changed the meaning of ElectronDensity from earlier meaning the ElectronDifferenceDensity, which is actually the relevant quantity to use when computing the dipole [https://arxiv.org/ftp/arxiv/papers/1708/1708.03834.pdf]. If I just change the ElectronDifferenceDensity I get m1=1.94D which at least is reasonable, albeit not too accurate (but the molecule was not optimized, and we don't use any fancy functional). This puts the "monopole" to zero (not exactly, because of numerics) which it should be for the difference density, whereas for the density it counts the number of electrons.