Resonance inversion in a superconducting cavity coupled to artificial atoms and a microwave background