Anzas said:
Since the distance between galaxies increases with time does that mean that the matter in those galaxies gets potential gravitational energy?
I don't think that happens in any simple way, Anzas, because in a uniform (homogeneous isotropic) universe there is negligible net pull on an isolated galaxy or cluster of galaxies.
the pulls in different directions cancel out
Were there a net pull on a galaxy that would probably be in a gravitationally bound structure, like a cluster. But the average increase in distance doesn't apply within clusters. Hubble law refers to average longrange distances and doesn't apply equally across the board. Within gravitationally bound systems average distances may not be increasing at all!
So to a first approximation you can say that if the distance between two widely separated things A and B is increasing according to Hubble Law, then the increase in distance is not doing work at least in any obvious straightforward way, because there is no net force on A towards B.
think of the balloon analog with pennies stuck on the balloon surface representing clusters of galaxies. each penny attracts every other along geodesics in the surface (but not acrosss the empty space inside the balloon which does not exist

). each penny is attracted about equally in all directions (2D directions within the space). no net force on it in anyone particular direction
there's more to say, but I have to go. maybe someone else will elaborate.