Your physics textbook seems to me to be giving a very poor description at this point. In fact all you need to think about is inter-molecular forces. Every water molecule pulls on every other one. That's all there is to it. No special potential energy. Just molecules pulling on each other. But potential energy can be a useful way of quantifying the result.
Think of a liquid such as water as made of millions of tiny bits of mater. In fact we may as well talk about molecules.
Suppose you have first of all some water with a flat surface. Now introduce a wiggle in the surface (and ignore gravity for this---imagine the experiment is being done in a low-gravity environment). Make this wiggle in such a way that the volume of the water has not changed. This means the water has the same density as it did, and therefore the same average distance between molecules. So all the inter-molecular forces between neighbouring molecules are still the same.
But something has changed: the surface area. This means that there are now more molecules at the surface than before.
Those extra molecules at the surface were previously in the body of the water, surrounded by water. Now they are at the surface, with water on one side, and air (or some other gas) on the other. So they have fewer bonds to the rest of the water than they used to have. As the water surface changed shape, various molecular pairs had to move apart from one another, and energy has to be supplied to make this happen. In other words, changing the shape of the surface to one with larger area requires energy to be provided! This is at the heart of the phenomenon called surface tension. It means that, in order to find the configuration of least energy, the surface pulls back so as to try to minimize its area.
Here is a 2-dimensional picture to illustrate the idea:
$$
\begin{array}{cccccccccccccccc}
. &. &. &. &. &. &. &. &. &. &. &. &. &. &. &. \\
. &. &. &. &. &. &. &. &. &. &. &. &. &. &. &. \\
. &. &. &. &. &. &. &. &. &. &. &. &. &. &. &. \\
. &. &. &. &. &. &. &. &. &. &. &. &. &. &. &.
\end{array}
$$
There are 64 dots altogether. 36 are at the surface; 28 in the bulk. Now imagine a line drawn between each pair of neighbours, and for simplicity just treat horizontal and vertical connections. You can find $16 \times 3 = 48$ vertical lines and $15 \times 4 = 60$ horizontal lines, making $108$ in total.
Now I will draw the same number of dots, but arranged in a shape with a smaller perimeter:
$$
\begin{array}{cccccccc}
. &. &. &. &. &. &. &. \\
. &. &. &. &. &. &. &. \\
. &. &. &. &. &. &. &. \\
. &. &. &. &. &. &. &. \\
. &. &. &. &. &. &. &. \\
. &. &. &. &. &. &. &. \\
. &. &. &. &. &. &. &. \\
. &. &. &. &. &. &. &.
\end{array}
$$
We have again 64 dots, but now with 28 at the surface and 36 in the bulk. The number of vertical bonds is $8 \times 7 = 56$ and the number of horizontal bonds is also 56, making $112$ in total. That's more bonds! So if the bonds represent attractive forces, as they do here, then this second configuration is the one where the dots have "pulled themselves together" more---even though the total volume has not changed. (To agree this statement about volume, don't forget that each dot represents the centre of a blob, not a mathematical point.)
You can have some fun rearranging these dots a little further to increase the total number of bonds a bit more.
What kind of shape are you heading towards?
What kind of shape do drops of water have in zero gravity?
The "potential energy" mentioned in your book is the potential energy associated with moving the molecules apart, breaking some of the bonds, when moving from a configuration of small surface area to one of larger surface area, under conditions of fixed density. It is a useful way of expressing the net result. But the underlying reason for it is the one I have explained.
In the case of any given blob of water, the energy it contains is all provided by the source of that blob of water, together with the forces, and possibly heat exchange, exerted on it by its environment. So there is no magic and energy is conserved.