Another way to think of it is the 317 is operating like a common base NPN transistor. With suitable biasing, an NPN transistor could be used to do exactly the same thing but the 317 includes all of the biasing built in as well as protection. This is another variation of the single LED, two resistor, and NPN transistor temperature compensated current sink.