Recurrence relation goes like this:
$$T(n)=3T\left(\frac{n}{3}\right)+1 \qquad \to (1) $$
Using substitution,
$$T(n)= 3\left(3T\left(\frac{\frac{n}{3}}{3}\right) +1\right) +1$$
$$ \implies T(n)=3^2T\left(\frac{n}{3^2}\right)+3+1 \qquad \to(2) $$
Use substitution again,
$$T(n)= 3^2\left(3{T\left(\frac{n}{3^3}\right)} +1 \right) +3 +1 $$
$$\implies T(n)= 3^3T\left(\frac{n}{3^3}\right) + 3^2 + 3 + 1 $$
$$\implies T(n)= 3^3T\left(\frac{n}{3^3}\right) + 3^2 + 3^1 +3^0\qquad \to (3)$$
Continuing like this up to $'k'$ times we get,
$$T(n)= 3^kT\left(\frac{n}{3^k}\right)+3^{k-1} + 3^{k-2}+\ldots+ 3^1 + 3^0\qquad \to (4)$$
put $n=3^k$ which is what question says i.e., $n =3^k$ (I am considering '$n$' in place of '$m$' as name doesn't matter here)
$$T(n)= 3^k + 3^{k-1} + 3^{k-2} + 3^{k-3}+\ldots +3^1 + 3^0$$
Solving above G.P. series with $a = 1, r=3$ we get
$$T(n)= \frac{{3^{k+1} -1}}{{3-1}}= \frac{3^{k+1}-1}{2}$$