They literally used inverse phase wave mapping to remove the vocals on his song, then sang the same lyrics, including the "Johnny C's in Trouble" line
Although the Glee version is a very close reproduction, I don't think it's done by channel phase inverting trick because that technique results in a mono backing track, and their backing track is clearly stereo. Plus if you listen closely on headphones you can hear they're using different drum samples and the instruments sound a bit different.
However, it's worth noting that the only thing used in Jonathan Coulton's cover from the original is the lyrics. The cover has completely new chord progression and vocal melody that doesn't exist in the original rap at all. Essentially in this case the "cover" is a completely different song with the lyrics from "Baby got back", so I think it's still a clear copyright violation regardless of how they reproduced Coulton's music.