9. Two people, A and B, are playing table tennis. They agree that the winner of each game gets 1 point, and the loser gets 0 points. The game stops when one person is 2 points ahead or when 6 games have been played. Suppose the probability of A winning each game is $\frac{2}{3}$, and the probability of B winning each game is $\frac{1}{3}$, and the outcomes of each game are independent. Then the expected number of games played $\mathrm{E} \xi$ when the game stops is $\qquad$
9. $\frac{266}{81}$.

According to the problem, all possible values of $\xi$ are $2, 4, 6$.
Let each two games be a round, then the probability that the match stops at the end of this round is $\left(\frac{2}{3}\right)^{2}+\left(\frac{1}{3}\right)^{2}=\frac{5}{9}$.

If the match continues after this round, then A and B must each score one point in this round, at which point, the result of this round has no impact on whether the match stops in the next round. Therefore,
$$
\begin{array}{l}
P(\xi=2)=\frac{5}{9}, \\
P(\xi=4)=\left(\frac{4}{9}\right)\left(\frac{5}{9}\right)=\frac{20}{81}, \\
P(\xi=6)=\left(\frac{4}{9}\right)^{2}=\frac{16}{81} .
\end{array}
$$

Thus, $E \xi=2 \times \frac{5}{9}+4 \times \frac{20}{81}+6 \times \frac{16}{81}=\frac{266}{81}$.