The Moon is finite, so this method can't supply limitless energy. But if you could do it with 100% efficiency, it would furnish the equivalent of current world energy consumption for over 7 billion years, although that BOTE calculation ignores the energy cost of cutting the Moon rock into convenient sized chunks.
This gravity well diagram from xkcd says that Earth's gravitational potential is equivalent to 6379 km in a constant $1g$ field, the figure for the Moon (also at $1g$) is 288 km. So the energy released by lifting mass $m$ from the Moon's surface and dropping it onto the Earth is $mg × 6091 km$.
Using $m=7.34767309 × 10^{22} kg$ for the mass of the Moon, and $g=9.81m/s^2$, we get $4.39043379×10^{30}$ joules.
That calculation ignores the fact that the Moon's gravity well gets shallower as we eat away at its mass. It also ignores the increase in the depth of Earth's gravity well as its mass increases due to the accumulated Moon rock.
However, there are enormous technical difficulties with this method, whether we catch the incoming Moon rock and somehow get it to turn a turbine, or allow it to burn up in the upper atmosphere and try to capture the heat it releases. Catching the heat would require the heat harvester to operate in the upper atmosphere. Catching the rocks themselves will put a lot of wear & tear on the equipment.
There's also the political dimension to consider. Plenty of people would not be happy with a railgun on the Moon that could be used as a weapon, or that could cause a disaster if anything went wrong with the aiming process.