The three-loop lattice free energy