Temperature inversion due to velocity filtration, a mechanism originally proposed to explain the heating of the solar corona, is demonstrated to occur also in a simple paradigmatic model with long-range interactions, the Hamiltonian mean-field model. Using molecular dynamics simulations, we show that when the system settles into an inhomogeneous quasi-stationary state in which the velocity distribution has suprathermal tails, the temperature and density profiles are anticorrelated: denser parts of the system are colder than dilute ones. We argue that this may be a generic property of long-range interacting systems.