Before us is Mishnah 7 in chapter 4 of Maseches Peah, which deals with the status of hekdesh (property consecrated to the Temple) with regard to the obligations of leket, shichechah and peah.
The basic rule - hekdesh is exempt:
Hekdesh, meaning anything that belongs to the Beis HaMikdash, is exempt from leket, shichechah and peah. The source of the exemption lies in the wording of the Torah, which says "uv'kutzrechem" - "when you reap," and "ketzircha" - "your harvest," a harvest that belongs to you. From here we learn that the obligation applies specifically to the produce of a private individual, while hekdesh is not included.
But a precise point must be made: the exemption is determined solely by who owns the produce at the moment the obligation takes effect. If at that moment the produce belongs to hekdesh, it is exempt; but the fact that it belonged to hekdesh in the past, or that it will belong to hekdesh in the future, is no grounds for an exemption.
The three cases in the Mishnah:
"Hikdish kamah ufadah kamah" - if he consecrated it as standing grain and redeemed it as standing grain, he is obligated. A person consecrated his produce while it was still standing grain, redeemed it from hekdesh while it was still standing, and only afterward reaped it. Since at the time of reaping, which is the moment the obligation takes effect, the produce was ordinary unconsecrated grain, it is obligated in leket, shichechah and peah. The mere fact that it once belonged to hekdesh is not sufficient reason to exempt it.
"Omarim ufadah omarim" - if he consecrated it as sheaves and redeemed it as sheaves, he is obligated. He consecrated the produce when it was already bundled into sheaves and redeemed it while it was still sheaves. The reaping preceded the consecration, so the obligation had already taken effect, and the consecration and redemption that followed do not remove it.
"Hikdish kamah ufadah omarim" - if he consecrated it as standing grain and redeemed it as sheaves, it is exempt. He consecrated it while it was still standing, and redeemed it only after it had become sheaves, which means the reaping took place at a time when the produce belonged to hekdesh.
The reason for the exemption is stated explicitly in the words of the Mishnah: "shebish'as chovasah haysah peturah" - at the moment of its obligation it was exempt. At the moment the obligation takes effect, which is the time of reaping, the produce was owned by hekdesh and exempt, and therefore even though it was redeemed afterward when it was already sheaves, it remains exempt.
In summary: we have learned that hekdesh is exempt from leket, shichechah and peah, since the Torah obligated specifically "ketzircha" - the harvest that belongs to a private individual. Everything depends on who owns the produce at the moment the obligation takes effect, which is the time of reaping: if he consecrated it and redeemed it while it was still standing grain, he is obligated; if he consecrated it and redeemed it when it was already sheaves, he is obligated, since the obligation had already taken effect at the time of reaping; but if he consecrated it as standing grain and redeemed it as sheaves, it is exempt, because at the moment of its obligation it was exempt.