Challah, Chapter 4, Mishnah 6. This mishnah deals with an ongoing situation in which there are doughs about which it is uncertain whether challah was separated from them, and at times these doughs may even be tamei. For this reason a person wishes to separate challah from a different source that will be tahor, and to separate it for the doubtful cases.
The words of the Mishnah:
"Notel adam kedei challah me'isah shelo hurmah challatah" - a person may take an amount sufficient to serve as challah for other doughs, provided that it is taken from a dough that is still obligated in challah. From a dough that has already been exempted from challah, one does not take challah on behalf of another place.
"La'asotah betaharah" - it is not made into challah immediately; rather, it is separated while it is still tahor, so that it can be used afterward. For it may be taken on behalf of a dough that is no longer tahor, but tamei.
"Lihyot mafrish aleha veholech challat demai" - on an ongoing basis one may separate this dough as challah for various doughs that are demai, that is, doughs about which it is uncertain whether challah was separated from them or not.
"Ad shetisrach" - until it rots and spoils. Once it has spoiled it is no longer effective, but as long as it has not spoiled it may be used as challah for those doughs about which there is a doubt.
The reason for the leniency:
At first glance there are two problems here: taking from the tahor on behalf of the tamei, which is generally not permitted out of concern that a person will separate them in order to prevent them from becoming tamei; and taking from that which is not adjacent, whereas normally the challah being taken must be next to the dough on whose behalf it is taken. On this the mishnah explains: "Shechallat demai" - since the dough from which it is taken is only a case of doubt, for it is not known whether challah was taken from it, the Sages were lenient in it in two respects:
"Nitelet min hatahor al hatamei" - it is permitted to take from the tahor dough on behalf of the tamei dough.
"Veshelo min hamukaf" - they need not be adjacent to one another.
These are the exceptions established for the case of challat demai.
Why is it called 'challat demai'?
Regarding the amei ha'aretz it is known that they did not always separate tithes, and therefore their grain and their produce are considered something from which tithes must be separated because of the stringency of demai - and this is the subject of the entire tractate Demai. But we do not find such a concern with regard to challah: it is known that they would separate Terumah, and there is no reason to suspect that they would fail to separate challah, which is given to a kohen.
Therefore some explain that the intent here is not the demai particular to the amei ha'aretz, but simply a case of doubt: for whatever reason, whether because of forgetfulness or for some other reason, it is not known whether challah was separated from that dough. The mishnah uses the term 'demai' in a borrowed sense, as a designation for anything about which there is a doubt, and this is the source of the usage of the term here. It emerges that the mishnah is dealing with any dough about which there is a doubt whether challah was separated from it.