The Greeks knew the diameter of the earth from Eratosthenes’ calculations. They also know that a sphere casts a conical shadow whose length is approximately 108 times its diameter.

More from M. Fowler at http://galileoandeinstein.physics.virginia.edu/lectures/gkastr1.html:

[D]uring a total lunar eclipse the moon moves into this cone of darkness [cast by the earth]. Even when the moon is completely inside the shadow, it can still be dimly seen, because of light scattered by the earth’s atmosphere. By observing the moon carefully during the eclipse, and seeing how the earth’s shadow fell on it, the Greeks found that *the diameter of the earth’s conical shadow at the distance of the moon was about two-and-a-half times the moon’s own diameter*.

*Question: At this point the Greeks knew the size of the earth (approximately a sphere 8,000 miles in diameter) and therefore the size of the earth’s conical shadow (length 108 times 8,000 miles). They knew that when the moon passed through the shadow, the shadow diameter at that distance was two and a half times the moon’s diameter. Was that enough information to figure out how far away the moon was?*

Well, it did tell them the moon was no further away than 108×8,000 = 864,000 miles, otherwise the moon wouldn’t pass through the earth’s shadow at all! But from what we’ve said so far, it could be a tiny moon almost 864,000 miles away, passing through that last bit of shadow near the point. However, such a tiny moon could never cause a *solar* eclipse. In fact, as the Greeks well knew, *the moon is the same apparent size in the sky as the sun*. This is the crucial extra fact they used to nail down the moon’s distance from earth.

They solved the problem using geometry, constructing the figure below. In this figure, the fact that the moon and the sun have the same apparent size in the sky means that the angle ECD is the same as the angle EAF. Notice now that the length FE is the diameter of the earth’s shadow at the distance of the moon, and the length ED is the diameter of the moon. The Greeks found by observation of the lunar eclipse that the ratio of FE to ED was 2.5 to 1, so looking at the similar isosceles triangles FAE and DCE, we deduce that AE is 2.5 times as long as EC, from which AC is 3.5 times as long as EC. But they knew that AC must be 108 earth diameters in length, and taking the earth’s diameter to be 8,000 miles, the furthest point of the conical shadow, A, is 864,000 miles from earth. From the above argument, this is 3.5 times further away than the moon is, so the distance to the moon is 864,000/3.5 miles, about 240,000 miles. This is within a few percent of the right figure. The biggest source of error is likely the estimate of the ratio of the moon’s size to that of the earth’s shadow as it passes through.