Solution (source code)

= Solution

Expand according to the hitting time and use <detailed balance> to reverse each finite path:
$$
\begin{aligned}
\mathbb P_\pi(X_{T_A}=z)
&=\sum_{n\geq0}
\sum_{x_0,\ldots,x_{n-1}\notin A}
\pi(x_0)P(x_0,x_1)\cdots P(x_{n-1},z)\\
&=\pi(z)\sum_{n\geq0}
\mathbb P_z(X_1,\ldots,X_n\notin A).
\end{aligned}
$$
The event in the final probability is $\{T_A^+>n\}$. The tail-sum formula for a nonnegative integer-valued random variable gives
$$
\sum_{n\geq0}\mathbb P_z(T_A^+>n)=\mathbb E_zT_A^+.
$$
Therefore
$$
\boxed{\mathbb P_\pi(X_{T_A}=z)=\pi(z)\mathbb E_zT_A^+}.
$$