At first glance the top's inversion may mistakenly seem to be a situation where the object spontaneously gains overall energy. This is because the inversion of the top raises the object's center of mass, which means the potential energy has in fact increased. What causes the inversion (and the increase in potential energy) is a torque due to surface friction, which also decreases the kinetic energy of the top, so the total energy does not actually increase.