A class may have the same name and number on a transcript, but that class is completely different depending on who is teaching it.
Take for instance a math class. Some teachers allow notes, give extra credit for showing up, and extra credit on their tests. Yet other teachers do not allow any of that. In the former case a C+ effort can yield a B+, while the in the latter a B+ effort may only yield a C+. The second student may have even learned more than the first one, but the second student made the mistake of taking the harder teacher.
It's this reason students get on ratemyprofessor.com and systematically choose the easiest classes. If students take the harder teachers, even if they learn more, they're punished in their GPAs for doing so.