Before, I made a post titled why is foaming difficult. Here, I introduced the idea that creation of an interface always costs energy and that many times the invisible forces at work tries to minimize the surface area for example by taking on spherical shapes (since spheres have the highest volume to surface ratio). But at that time, I did not have a great answer as to why making surface always takes energy.
Recently, I had this new idea. First, where do surfaces exist? Where there is phase separation. Why is there phase separation? Because the two phases are not miscible. Why are they not miscible? Because they like themselves better than each other... Since surface forces the molecules to loose interaction with one another and form interaction with the other phase (which by the virtue of the fact that these are not miscible is less favorable), the surface costs energy.