I didn't write this.
For replacement of non-grounding-type receptacles with grounding-type receptacles and for branch-circuit extensions only in existing installations that do not have an equipment grounding conductor in the branch circuit, connections shall be permitted as indicated in 250.130(C). C) Nongrounding Receptacle Replacement or Branch Circuit Extensions. The equipment grounding conductor of a grounding-type receptacle or a branch-circuit extension shall be permitted to be connected to any of the following: (1) Any accessible point on the grounding electrode system as described in 250.50 (2) Any accessible point on the grounding electrode conductor (3) The equipment grounding terminal bar within the enclosure where the branch circuit for the receptacle or branch circuit originates (4) For grounded systems, the grounded service conductor within the service equipment enclosure (5) For ungrounded systems, the grounding terminal bar within the service equipment enclosure If you use the water pipe, the connection must be within 5 feet of where the pipe enters the building.
You are permitted to replace a two-wire nongrounding type receptacle with a GFCI under the following in section 406.3 (3) Nongrounding-Type Receptacles. Where grounding means does not exist in the receptacle enclosure, the installation shall comply with (a), (b), or (c). (a) A nongrounding-type receptacle(s) shall be permitted to be replaced with another nongrounding-type receptacle(s). (b) A nongrounding-type receptacle(s) shall be permitted to be replaced with a ground-fault circuit interrupter-type of receptacle(s). These receptacles shall be marked "No Equipment Ground." An equipment grounding conductor shall not be connected from the ground-fault circuit-interrupter-type receptacle to any outlet supplied from the ground-fault circuit-interrupter receptacle. (c) A nongrounding-type receptacle(s) shall be permitted to be replaced with a grounding-type receptacle(s) where supplied through a ground-fault circuit interrupter. Grounding-type receptacles supplied through the ground-fault circuit interrupter shall be marked "GFCI Protected" and "No Equipment Ground." An equipment grounding conductor shall not be connected between the grounding-type receptacles. When you make this change be very, very careful that you get the hot "black" wire on the right side of the outlet.
(B) With Circuit Conductors. By an equipment grounding conductor contained within the same raceway, cable, or otherwise run with the circuit conductors.
NEC HANDBOOK COMMENTARY;
One of the functions of an equipment grounding conductor is to provide a low-impedance ground-fault path between a ground fault and the electrical source. This path allows the overcurrent protective device to actuate, interrupting the current. To keep the impedance at a minimum, it is necessary to run the equipment grounding conductor within the same raceway or cable as the circuit conductor(s). This practice allows the magnetic field developed by the circuit conductor and the equipment grounding conductor to cancel, reducing their impedance.
Magnetic flux strength is inversely proportional to the square of the distance between the two conductors. By placing an equipment grounding conductor away from the conductor delivering the fault current, the magnetic flux cancellation decreases. This increases the impedance of the fault path and delays operation of the protective device.