The trick appears to be about what exactly it is that is denoted by letter "x" in the calculation in question, and what is implicitly assumed about relevant probabilities.

Let e1 and e2 be random variables denoting amounts in the envelopes marked 1 and 2, respectively. Then, obviously:

p(e1 > e2) = p(e2 > e1) = 1/2

However, the probability to find more in envelope 2 than in envelope 1 given amount x in envelope 1 must be conditional on x:

p(e2 > e1 | e1 = x) = p(e2 > x)

It depends on x, and is either 1 or 0 depending on whether x is the minimum or the maximum of its two possible values. It cannot be 1/2 irrespective of x as assumed by the calculation in question.