This is standard practice among manufacturers.
In Trek's defense, it is a way to realistically give a lifetime warranty on something they know for a fact that will break if you use it enough, even if you do not abuse it. At least this is the case for aluminum frames, since aluminum can only withstand a limited number of flexing cycles before it breaks. If the warranty were transferable to other owners, they would eventually have to give new frames for every frame they sell. Limiting the warranty to the original owner should decrease dramatically the number of frames they will have to replace, making it economically feasible to offer lifetime warranty.
This way, the original owner gets lifetime warranty without paying a huge premium for that, at the expense of a lower resale value down the road. The second hand buyer, can adjust his offering price to the fact that he is buying a frame without warranty.
This scheme, however, is tougher to sell when we're talking about 2-year warranties. It's just an annoyance, since it wouldn't cost that much to extend the 2-year warranty to second hand owners.