Let's start with lenses at the same location, and then address the moving the longer lens farther away to get the same field of view.
Lenses at the same location
The 50mm f/1.4 lens has an effective aperture that's twice the diameter, and four times the area, of the 25mm f/1.4 lens. The 50mm will, therefore, collect four times as much light (four times as many photons) from the light source as the 25mm (assuming all other aspects of the setup are identical, and the light source fits inside the field of view of both lenses).
However, the 50mm lens will produce an image that's twice as big in each dimension as the 25mm lens. That means that the 4x as many photons will be distributed over a 4x larger area on the sensor. The result is that each lens will each record the same number of photons per pixel on the sensor. This is why photographers work with f-numbers: Photographic exposure is about keeping the number of counts per pixel in a sane range (high enough for good signal-to-noise, without exceeding the maximum value the pixel can record).
So in this setup, the question of "which gathers more light" depends on whether you're thinking on a per-pixel basis, or integrating the counts over the whole image of the light source.
Distance of lenses adjusted to give the same magnification
Now, suppose we move the 50mm lens twice as far away, so the image of the light source is the same size as with the 25mm lens.
Compared to the previous situation, the 50mm lens has an 1/r^2 loss of (1/2)^2 = 1/4, so it collects 1/4 as many photons as it did before. That means it collects the same number of photons as the 25mm lens does at half the distance. And since we've moved the distance to make the image size the same, those photons fall into the same area on the sensor as the 25mm lens at half the distance.
So, indeed, the 50mm f/1.4 lens at twice the distance as the 25mm f/1.4 lens collects the same number of photons, and images them into the same area on the sensor. So both the total number of photons, and the photons per pixel, will be the same for the two setups.
Note: There are a variety of real-world factors that could throw this equivalence off slightly. For example, AJ Henderson points out that working f-number will vary for objects not at infinity, and real lenses don't have perfect transmission.