Here is an alternative way of using conditional probability, beside the answer via conditional probability by @Dilip Sarwate in another question. (This answer is adapted from the book "An Introduction to Stochastic Modeling" [Section 2.2 The Dice Game Craps] by Pinsky and Karlin)
Consider repeated rolls of the pair of dice and let $Z_n$ ($n \in \mathbb{N}$) be the sum observed on the $n$-th roll.
Denote the event of "$\textrm{5 before 7}$" by $B$ and its probability $\alpha$.
According to the law of total probability, we obtain
$$\alpha = P \{ B\} = \sum_{k=2}^{12} P \{B \mid Z_1 = k \} P \{ Z_1 = k\}$$
Now we have
$$P \{ B \mid Z_1 = 5 \} = 1, \quad P \{ B \mid Z_1 = 7 \} = 0.$$
If the first roll results in anything other than 5 or 7, the problem is repeated in a statistically identical setting. That is,
$$P \{ B \mid Z_1 = k \} = \alpha, \forall k \neq 5, 7.$$
Therefore, we have
$$\alpha = P \{ Z_1 = 5 \} \times 1 + P \{ Z_1 = 7 \} \times 0 + \sum_{k \neq 5,7} P \{ Z_1 = k \} \times \alpha \\ = P \{ Z_1 = 5 \} + [1 - P \{ Z_1 = 5 \} - P \{ Z_1 = 7 \}] \alpha$$
Solving this equation, we get
$$\alpha = \frac{P \{ Z_1 = 5 \}}{P \{ Z_1 = 5 \} + P \{ Z_1 = 7 \}} = \frac{\frac{4}{36}}{\frac{4}{36} + \frac{6}{36}} = \frac{2}{5}.$$