In both cases, the system is the liquid in the (tray+tube).
I have made reasonably accurate calculations for the gravitational potential energy part. It follows from the calculations that the gravitational P.E. increases for both water as well as for mercury.
But I haven't been able to decipher the surface energy part of the question. At first glance, it appears that it must increase in both the cases (as surface area of contact between water and air in the capillary tube increases). However, I haven't been able to convince myself regarding the same.
Can someone please help with the surface energy as well as the total energy part? Also, what if the liquid is mercury instead of water?
Thanks in advance :)