Pesachim, Chapter 9, Mishnah 4. Our Mishnah deals with the Korban Pesach that was offered in a state of tumah - when the majority of the community is tamei, or when the majority of the kohanim are tamei, in which case everyone offers it and eats it in a state of tumah. The question discussed in the Mishnah is who nevertheless remains excluded from eating it, and what the law is if such a person went ahead and ate.
Who may not eat from a Pesach brought in tumah:
Even though the Pesach is eaten in a state of tumah, it is not eaten by every person. Four categories of temei'im may not eat from it:
"Zav" - a man who is a zav.
"Zavah" - a woman who is a zavah.
"Niddah" - a woman who is a niddah.
"Yoledes" - a woman who has given birth and is still tamei.
What all four have in common is that their tumah is what is called "tumah ha'yotzeis migufam" - tumah that issues from their own bodies, unlike the tumah of a corpse. The special permission to offer the Pesach in a state of tumah was stated only regarding the tumah of a corpse; but those with a different kind of tumah, such as these, may not eat from the Korban Pesach.
The exemption from kareis:
Ordinarily, a person who is tamei, who may not eat and nevertheless ate kodashim, is liable to kareis. In our case, however, even though they may not eat, they are exempt from kareis for eating while in their state of tumah.
The reason is this: the liability of kareis for eating kodashim in a state of tumah was stated specifically regarding kodashim that are eaten in purity. But these kodashim, as we learn from the verse, are eaten in a state of tumah, and therefore even if someone who is tamei ate them, he is not liable to kareis for them. The result is that on the one hand they may not eat it to begin with, since their tumah is not the tumah of a corpse but of a different kind, and on the other hand they are exempt from kareis.
The view of Rabbi Eliezer - even regarding entering the Mikdash:
Rabbi Eliezer went one step further: even one who enters the Beis HaMikdash in a state of tumah is liable to kareis, yet these people are exempt even for entering the Beis HaMikdash while in their state of tumah. This does not mean that it is permitted to them - they are forbidden to enter, and they must be sent outside the Mikdash - only that they are not liable to kareis.
The reason is similar: the liability of kareis for entering the Mikdash applies specifically when all those present in the Beis HaMikdash are pure. But at a time when the community is tamei, even with the tumah of a corpse, those with a different kind of tumah are not liable to kareis at that time.
In summary: a Pesach brought in a state of tumah may be offered and eaten in the tumah of a corpse, but zavim, zavos, niddos and yoldos - whose tumah issues from their own bodies - may not eat from it. If they ate, they are exempt from kareis, since the liability of kareis was stated only regarding kodashim that are eaten in purity. And according to Rabbi Eliezer, they are exempt from kareis even for entering the Mikdash at such a time, because this liability applies only when the entire community is pure.