Definitely a code violation, and has two main safety problems.
The first problem is that the ground to follow the same path that the power does. You can’t just run ground wires willy nilly all over the place. You could have something damage the ground without damaging the power wires, which would result in a loss of ground without being noticed. It also makes things very difficult to troubleshoot.
The second problem is that you grounded to a water pipe.
Back in the old days, you were actually required to ground your house through the cold water pipe, since this was a nicely grounded hunk of metal that was present on all homes. You weren’t supposed to use your home’s plumbing as a safety ground though.
And then they invented plastic pipe, which meant that you could no longer rely on your cold water pipes to provide an earth ground connection. You still want all of your water pipes to be grounded because you don’t want an accidental short to turn all of your plumbing into a hot electrical connection, so your water pipes still have a connection to earth ground, but the purpose is backwards from what it was originally. Instead of using the pipes as a ground you now cannot rely on the pipes for your ground, and you only ground the pipes for safety.
Because of the double-fault you created, if someone replaces the pipe with PVC between your clamp-on connection and the service entrance (where it should be grounded), the entire copper plumbing on your clamp’s side of the PVC will be grounded only to whatever is plugged into that outlet. If something shorts, all of that plumbing becomes a hot wire, with no visible indication whatsoever of a dangerous fault.
For example, if someone replaces a section of pipe with PVC, then someone plugs in a computer into that outlet (because it’s the only 3 prong), then the entire plumbing section can float up to 120 volts and someone washing their hands can be killed by the resulting electric shock. And there is absolutely no visible indication that the fault exists.
I hope you put everything back the way it was when you were done renting.
A GFCI works by comparing the current in the hot with the current in the neutral. If they are different, then the GFCI assumes that there was some sort of ground fault and trips. The GFCI and the circuit that it is attached to do not need a ground connection in order to function. The GFCI is only looking at the hot and neutral.
This is why a GFCI with a label indicating that no ground is present is legal.