How can a black hole's own gravity, but not light, escape from it?

In the case of a black hole, it's best to think of gravity as Albert Einstein described it: a warp in space-time. Einstein's theory of special relativity says that mass warps the space around it. For relatively lightweight bodies, like Earth, the effect is tiny. For heavier objects, like the Sun, the effect is small but detectable. (Scientists confirmed the effect, among other ways, by measuring the orbit of Mercury, the closest planet to the Sun, which is dragged forward a bit by the Sun's distortion of space-time.) And for the most massive objects, like black holes, the effect is enormous. Diagrams in astronomy textbooks often depict black holes as deep "wells" in space-time, with matter funneling into the black hole like pebbles dropped into a water well on Earth. So nothing has to "escape" from the black hole for it to exert a gravitational influence on the matter and space around it.