Another Explanation of the Error

Before we open any envelopes, it doesn't seem unreasonable to assume that if the envelopes are said contain A and 2A (without distinguishing which envelope contains which amount), then all values of A are equally likely − because we have no better information. However, it does not then follow from this assumption that, given A is found in the first envelope, the other envelope is equally likely to contain (1/2)A or 2A for every conceivable value of A (which is something we have implied in the subsequent calculation of expected value). 

Why?

Because, for any specific amount of money from which to fill the envelopes, given we have found A in the first envelope, for all values of A we can always find (1/2)A in the second envelope, whereas it is only possible to find 2A in the second envelope half the time.

See it like this: If the specific amount of money is M say, then we can find A to have any value up to (2/3)M, but the second envelope can only contain 2A for values of A up to (1/3)M ie. half as often.

So, given A was found in the first envelope, the chance of finding (1/2)A in the second envelope is 2/3, and the chance of having 2A in the second envelope is 1/3 − not equal as we had assumed, even though all values of A are still being assumed to be equally likely.