This is just configured like any other route in your routing table. In the same manner that you add a route for whatever network you're on when you configure a new interface, you do the same for the loopback interface. This is by no means an automatic function of the TCP/IP stack, although many systems will be configured by a third party to do it for you.

Example, windows NT:

C:\> route print
<Irrelevant bits skipped>
Network Destination       Netmask        Gateway     Interface     Metric
          127.0.0.0     255.0.0.0     127.0.0.1      127.0.0.1          1

In human readable form, this translates as "route all packets destined for 127.* via the interface configured with the IP address 127.0.0.1"