Demai, Chapter Seven, Mishnah Two
In this mishnah we learn that although the person eating at someones house who does not tithe made a declaration on the eve of Shabbat that he is now tithing the food that he will eat tomorrow, he must, under certain circumstances, again tithe on Shabbat itself.
I am going to explain this mishnah according to Albeck. Kehati offers a slightly different explanation and also notes that there is an entirely different understanding of the mishnah.
They pour him a cup [of wine on the sabbath], he says: What I will leave at the bottom of the cup shall be tithe, and what is nearest to it shall be the rest of the tithe. That which I made tithe shall become terumat maaser for the whole, and second tithe is at the mouth of the cup, and it is exchanged for money.
The person who is observant of the laws of tithing is now at his friends house and he is served a cup of wine, which he can assume has not been tithed. He now declares again that he is separating tithes from the wine, even though he made the declaration yesterday. The declaration is basically the same as that which he made the day before.
What makes this mishnah puzzling is why it mentions specifically wine and not other foods. Albeck explains that the other foods would have been prepared before Shabbat, because it is forbidden to cook on Shabbat. Therefore, the declaration that was made the day before is completely sufficient. In contrast, wine is not mixed with water (this is how they drank their wine) until right before it is drunk, in this case on Shabbat. Therefore, he has to make the tithe declaration again on Shabbat. Normally, it is forbidden to tithe on Shabbat, but in this case it is permitted because he had already made a declaration the day before.