The obligation of challah is from the time of kneading. But if one separated from flour, and placed the challah into the oven – it is nothing, and one must separate another when he kneads. And in a place where they give it to a kohen, we learned in the Mishnah of Challah (Mishnah Challah 2:5): One who separates his challah as flour – it is not challah, and it is theft in the hand of the kohen. And it is not only necessary to say if he is an am ha'aretz who did not know the law. Even if he is a talmid chakham and knows the law, and we should have said that he gave him the flour as a gift, nevertheless he is obligated to return it, for if he does not return it, it will lead to a pitfall, as they will say that it is challah (Taz, subsection 1, from Kiddushin 46b, see there). Therefore, even the flour that is with the kohen, if it contains five revi'im – it is obligated in challah, and so too the flour in the hand of the homeowner. Nevertheless, the flour is forbidden to a zar, because the name "challah" was called upon it. Thus the Tur ruled according to the Mishnah there, for Rabbi Yehoshua holds so, see there. However, the Rambam explains there a different explanation, see there.
חיוב החלה הוא משעת לישה. אבל אם הפריש מקמח, ונתן החלה לתוך התנור – אינו כלום, וצריך להפריש אחרת כשיָלוש. ובמקום שנותנין לכהן, שנינו במשנה דחלה (משנה חלה ב ה): המפריש חלתו קמח – אינה חלה, וגזל ביד כהן. ולא מיבעיא אם הוא עם הארץ שלא ידע הדין. ואפילו אם הוא תלמיד חכם ויודע הדין, והיה לנו לומר שנתן לו הקמח במתנה, מכל מקום חייב להחזיר, דאם לא יחזיר יבוא לידי קלקול, שיאמרו שחלה היא (ט"ז סעיף קטן א' מקידושין מו ב עיין שם). ולכן גם הקמח שאצל הכהן, אם יש בו חמשת רבעים – חייבת בחלה, וכן הקמח שביד הבעל הבית. ומכל מקום הקמח אסור לזר, מפני שנקרא עליה שם "חלה". כן פסק הטור על פי משנה דשם, דסבירא ליה לרבי יהושע כן, עיין שם. אך הרמב"ם מפרש שם פירוש אחר, עיין שם.