[step:Translate the local Markov property into a neighbour dependence identity]
Fix a vertex $u \in V$. Let
\begin{align*}
R_u:=V\setminus(\{u\}\cup N(u))
\end{align*}
be the set of vertices that are neither $u$ nor neighbours of $u$.
The local Markov property says
\begin{align*}
X_u \perp X_{R_u}\mid X_{N(u)}.
\end{align*}
Because $\pi$ is strictly positive on the finite configuration space, every event determined by a complete assignment of coordinates has positive probability. Thus the local Markov property is equivalent to saying that, for every $n \in \prod_{w \in N(u)}S_w$, every $r \in \prod_{w \in R_u}S_w$, and every $a \in S_u$, the conditional mass
\begin{align*}
\mathbb P(X_u=a\mid X_{N(u)}=n,\,X_{R_u}=r)
\end{align*}
is independent of $r$.
For $a \in S_u$, $n \in \prod_{w \in N(u)}S_w$, and $r \in \prod_{w \in R_u}S_w$, write $(a,n,r)\in\Omega$ for the unique configuration whose $u$-coordinate is $a$, whose $N(u)$-coordinates are $n$, and whose $R_u$-coordinates are $r$. The finite conditional probability formula gives
\begin{align*}
\mathbb P(X_u=a\mid X_{N(u)}=n,\,X_{R_u}=r)
=
\frac{\pi(a,n,r)}{\sum_{c \in S_u}\pi(c,n,r)}.
\end{align*}
Therefore, for all $a,b \in S_u$, all $n \in \prod_{w \in N(u)}S_w$, and all $r,r' \in \prod_{w \in R_u}S_w$, the independence of the conditional mass from $r$ gives
\begin{align*}
\frac{\mathbb P(X_u=a\mid X_{N(u)}=n,\,X_{R_u}=r)}{\mathbb P(X_u=b\mid X_{N(u)}=n,\,X_{R_u}=r)}
=
\frac{\mathbb P(X_u=a\mid X_{N(u)}=n,\,X_{R_u}=r')}{\mathbb P(X_u=b\mid X_{N(u)}=n,\,X_{R_u}=r')}.
\end{align*}
Substituting the displayed conditional formula and cancelling the positive normalizing denominators yields
\begin{align*}
\frac{\pi(a,n,r)}{\pi(b,n,r)}
=
\frac{\pi(a,n,r')}{\pi(b,n,r')}.
\end{align*}
Taking logarithms gives
\begin{align*}
f(a,n,r)-f(b,n,r)=f(a,n,r')-f(b,n,r').
\end{align*}
Thus, for fixed $a,b \in S_u$ and fixed neighbour configuration $n$, the logarithmic difference obtained by changing the $u$-coordinate from $b$ to $a$ is independent of all coordinates in $R_u$.
[/step]