By 'fair game', they mean that if the game were played many, many times, you would expect each player to win just as much money as they lost. In other words, neither player is favored in the long run (though of course some player always wins a particular game).
I'll assume you mean player A flips a coin three times, then player B flips the coin three times, then player A flips three times, and this repeats until someone obtains 'heads'. If so, here's how to solve it.
First, calculate the probability that A does not win on his/her first turn. That is simply the probability that a coin flipped three times turns up no 'heads'. That probability is (1/2)^3 = 1/8. So, that means A has a 7/8 chance of winning on his/her first turn.
Assuming A doesn't win (which happens 1/8 of the time), B then flips three times. The probability that B doesn't win these three flips is again 1/8, so the probability of B winning on his/her first turn (if B gets a first turn) is 7/8, just as it was for A. But B only gets a first turn 1/8 of the time. So the actual probability of B winning on his/her first turn is the product of these two probabilities: 1/8 * 7/8 = 7/64.
The same argument then goes for A's second turn, with the probability of winning being 7/8 again, assuming A gets a second turn. But the probability of getting to A's second turn is 1/8 * 1/8 = (1/8)^2. So the total probability of A winning on his/her second turn is (1/8)^2 * 7/8 = 7/512.
The pattern repeats. The total probability of B winning on his/her second turn is (1/8)^3 * 7/8 = 7/4096.
The total probability of A winning on his/her third turn is (1/8)^4 * 7/8 = 7/32768.
Summing up all the terms for player A to find the final probability that A wins the game, we get an infinite series, which evaluates to:
Probability that A wins = 7/8 + 7/8*(1/8)^2* + 7/8*(1/8)^4 + 7/8*(1/8)^6 + ...
Probability that A wins = 7/8 * (1 + (1/8)^2* + (1/8)^4 + (1/8)^6 + ...)
Probability that A wins = 7/8 * (64/63)
Probability that A wins = 8/9
So, A wins the game with a probability of 8/9. We can then deduce that B wins the game with a probability of 1/9. For a fair game, A must put of 8/9 of the stakes, or:
A's stakes = 8/9 * $20
A's stakes = $17.77777777...