Which is the right way to do it?
or
The top is probably better, although depending on circumstances, you might want to use the bottom. If the 5 V supply is isolated, then the top scheme is required.
The reason I prefer the top scheme (assuming non-isolated supply) is due to regulation. The power supply will regulate the voltage between its power and ground output on the 5 V side. Even though the ground output there is tied to the ground input, it won't be at exactly the same voltage. Whatever current the supply is drawing causes a voltage drop across its ground input lead, and there can be small internal voltage drops and noise added. The only place you are guaranteed all the specs of the power supply output is between the two terminals in the right side of the supply in your top diagram.