The data needed to answer the question was collected by the Lunar Prospector Electron Reflectometer (ER). The data is then processed to derive the electrostatic potential, which is the same thing as the voltage.
This article describes how the ER performs its measurements.
From the article:
The electron reflectometer works by measuring the pitch angles of solar wind electrons reflected from the Moon by lunar magnetic fields. Stronger local magnetic fields can reflect electrons with larger pitch angles.
The following article describes how the data collected was analyzed to produce the voltage measurements of the moon.
Lunar Prospector observations of the electrostatic potential of the lunar surface and its response to incident currents
 We present an analysis of Lunar Prospector Electron Reflectometer data from selected time periods using newly developed methods to correct for spacecraft potential and self‐consistently utilizing the entire measured electron distribution to remotely sense the lunar surface electrostatic potential with respect to the ambient plasma. These new techniques enable the first quantitative measurements of lunar surface potentials from orbit. Knowledge of the spacecraft potential also allows accurate characterization of the downward‐going electron fluxes that contribute to lunar surface charging, allowing us to determine how the lunar surface potential reacts to changing ambient plasma conditions. On the lunar night side, in shadow, we observe lunar surface potentials of ∼−100 V in the terrestrial magnetotail lobes and potentials of ∼−200 V to ∼−1 kV in the plasma sheet. In the lunar wake, we find potentials of ∼−200 V near the edges but smaller potentials in the central wake, where electron temperatures increase and secondary emission may reduce the magnitude of the negative surface potential. During solar energetic particle events, we see nightside lunar surface potentials as large as ∼−4 kV. On the other hand, on the lunar day side, in sunlight, we generally find potentials smaller than our measurement threshold of ∼20 V, except in the plasma sheet, where we still observe negative potentials of several hundred volts at times, even in sunlight. The presence of significant negative charging in sunlight at these times, given the measured incident electron currents, implies either photocurrents from lunar regolith in situ two orders of magnitude lower than those measured in the laboratory or nonmonotonic near‐surface potential variation with altitude. The functional dependence of the lunar surface potential on electron temperature in shadow implies somewhat smaller secondary emission yields from lunar regolith in situ than previously measured in the laboratory. These new techniques open the door for future studies of the variation of lunar surface charging as a function of temporal and spatial variations in input currents and as a function of location and material characteristics of the surface as well as comparisons to the increasingly sophisticated theoretical predictions now available.