Does the body lose energy or gain energy relatively when drinking or eating hot things?
Gains heat; humans are not particularly well-adapted to make use of heat as an energy source.  In a simple matter, if something you eat is hot when it goes in then the average temperature of the body has increased.  More relevantly (and to get this more on-topic for biology), eating anything will generally increase your body temperature, as in order to digest the food your rate of metabolism will rise.  Metabolism produces a lot of heat, and that's what you feel after eating, especially a big meal.

Something like cold water, however, that doesn't require a whole lot of metabolism, will cool you down.  In fact, even drinking hot water might cool you down.  The paper cited there claims that drinking a hot drink on a hot day will disproportionally increase your sweat response such that you actually cool down.