Mishnah 6 in the fifth chapter of Maseches Ma'aser Sheni deals with the laws of temed. Let us first clarify what this beverage is, and then work out its laws regarding berachos and the separation of Terumos and Ma'asros.
What is temed:
Temed is an inferior kind of wine, produced by soaking water together with the refuse of pressed grapes or with the lees - the sediment at the bottom of the wine barrel. Soaking the sediment in water, along with whatever liquid remains in it, creates a sort of new grape juice, which can be left to ferment and turned into wine.
At first glance this sounds so inferior that it would hardly count as wine at all, but bear in mind that in the times of Chazal ordinary wine was substantially diluted with water from the outset: regular wine was fermented grape juice with a significant amount of water added to thin it. Temed is indeed not as good as pure grape juice, but the halachic status of wine can apply to it.
The case in the Mishnah and the determining ratio:
Our Mishnah deals, for technical reasons that are beyond our scope here, with temed made by soaking water in the lees - the sediment at the bottom of the barrel - and not in pressed grapes. The basic halachah depends on the ratio between the liquid that came out of the lees and the water:
One part liquid from the lees against three parts water: its status is that of wine, its berachah is Borei Pri HaGefen, and the usual laws of separating Terumos and Ma'asros apply to it.
Less than this ratio: it is nothing more than flavored water, its berachah is Shehakol, and like water it is not subject to the obligation of separating Terumos and Ma'asros.
What remains to be clarified is how one can actually know how much grape liquid came out of the lees. In practice it was done like this: one takes the wine barrel with the residue at the bottom, pours water into it, and strains it again through a strainer. The result is water that has the taste of wine, and hopefully the status of wine as well.
The words of the Mishnah:
"HaMetamed venasan mayim b'middah u'matza k'dei middah - patur" - a person who makes temed and puts in a measured amount of water, let us say three cups, and after straining finds that very same amount, three cups of red liquid - he is exempt. The reasoning of the Tanna Kamma: there is no reason to assume that the new mixture contains one part in four of grape juice, since no liquid was added. In his view, in order to recite Borei Pri HaGefen and in order for it to be obligated in Terumos and Ma'asros, one must put in three cups of water and take out four cups of liquid - a sign that one cup out of the four came from grape liquid.
Although the Mishnah says "k'dei middah," that is not entirely precise. Even if he put in three and found three point nine, the Tanna Kamma holds that the addition is negligible and insufficient; a full extra cup is required for every three cups he put in.
And why did the Mishnah say "k'dei middah," rather than anything less than a full additional third? In order to show the strength of Rabbi Yehudah's position, who is stringent and obligates even if he put in three and took out three. His reasoning: who says that a full quarter of the mixture, originating in the grape lees, was not obtained here? Surely some of the water was lost, and surely some grape juice was added. Therefore one should not assume that the ratio falls short of the required one to three, and if it looks like temed and smells like temed, it is temed, even though no liquid was added to the resulting mixture.
"Matza yoser al k'dei middah - motzi alav mimakom acher lefi cheshbon" - "If he found more than the measure he put in, he takes the tithe for it from another source, according to the calculation":
That is, he found more than he put in. According to the first opinion (Tanna Kamma), this means that he put in three and got back four, or put in six and got back eight, and the like, in which case it is certainly obligated in tithes even according to his view. In such a case one may even tithe this temed mixture using grape juice or other wine. It goes without saying that one may tithe from the liquid itself, that is, separate the required amount from the four cups he has in hand; the novelty is that its status is that of full-fledged wine, and therefore other wine that is designated on behalf of this temed can even be counted as Terumas Maaser.
"Lefi cheshbon" - "according to the calculation": how so?
The first opinion holds that the water component is not obligated in Terumos and Maasros. Let us illustrate: he put three liters of water into the dregs, strained it, and drew off four liters of liquid. Says the first opinion: one liter is grape juice and three liters are water - and that is the amount needed to create the obligation of Terumos and Maasros, and therefore it can be tithed.
And how much must be tithed from it? Only the grape juice component within it. Even though the barrel holds four liters of temed, only one of them is obligated in Maaser. Therefore one separates one hundred milliliters for the entire four liters. Normally one separates ten percent of the wine, and four liters of wine would require four hundred milliliters; but here, since three of the four liters are exempt from the obligation of Maaser, one tithes only for the single liter that came from the grape juice. This is the meaning of "lefi cheshbon": everything follows the calculation of the amount of actual grape juice it contains, whether one takes the Maaser from another source on behalf of this temed or takes it from the temed itself.
In summary: the halachah follows the first opinion: he must draw off an additional liter for every three liters of water that were put in, in order for the temed to become obligated in the separation of the various tithes.