How does H2O Wireless work with the iPhone without needing any unlock?
H₂O doesn't provide a network of its own. Instead, it purchases bandwidth in bulk from a carrier, in this case AT&amp;T, and provides prepaid service using the carriers network.

So your friends phone isn't unlocked, but works just fine on the carrier network that its locked to.