When items from a purchased chest are added to your collection, they're not sorted properly by price until you leave the shop; all the other sorts (including rarity) work fine.
It has always seemed to me that the game values the items from purchased chests as higher grade than usual. Purchased Epics come before old Legendaries in your inventory, Rares before old Epics etc. It's like there are internal, higher prices for these items until you navigate away from the purchase screen, then they normalise. It's actually a little useful in that when you open a bunch of chests (I've been using the gold-priced chests as gold sinks) you can easily see how many high-rarity items you got in the lot.
The order seems to be (at least for the above example): new epics, new rares, new uncommons, old legendaries, new commons, old epics...
Wow, even uncommons above legendaries? I don't recall the order that well, it's been a while since I've bought any chests.
I tried buying some epic chests on the test server and the sorting by cost (only while staying in the chest shop screen) uses the prices it would cost to buy an item from the shops as the sort value for the new chest items and the sell value as the sort value for old items. Thus, first come new legendaries (buy for 2,500), then old legendary treasures (sell for 1,000, I'll leave out the rest of the treasures), new epics (buy for 500), old legendaries (sell for 100) mixed with new rares (buy for 100), new uncommons (buy for 25), old epics (sell for 20), then old rares (sell for 5) mixed with new commons (buy for 5), old uncommons (sell for 2) and finally old commons (sell for 1). A funny quirk of the system.
A good explanation! Imagine if we could somehow sell back the chest items to the chest store, thus getting at minimum 1015 gold (3 x 5 for commons+ 2 x 500 for epics) for 150 pizza (6.8 gold per pizza) and often a lot more when a useless Legendary shows up.
New build didn't change this, old legendaries still sorting between new uncommons and new commons. Also, I just noticed that within a rarity, items are sorted by level, not name.