It's called extracting consumer surplus.
Basically I have a bunch of movie goers (who have paid a lot for their tickets). Some of them don't like popcorn, and some do. Of the people in the latter group, there are some who are willing to pay a lot for it. That's partly because I have a select group (rich movie goers) and partly because some of these people would be willing to pay more for popcorn with a movie than without.
If I were just selling "popcorn," I'd have to charge a competitive price. But I'm really selling movies, which have more than covered my costs (rent, heat, etc.) So my costs of selling popcorn are less than that of a non-movie popcorn seller, and I don't really "need" to sell it. Ironically, it means that I can "take my chances" and sell a relatively small amount at a high price, thereby maximizing my UNIT profit. I don't mind having people NOT buy popcorn because I've already made my profit from them with the movie.
From the point of view of the consumer, most consumers see popcorn as an "afterthought." They will seldom think, "I can buy popcorn $2.00 cheaper at Theater A than Theater B, and there's a 20 percent chance that I will want to buy popcorn, so Theater A is 40 cents ($2.00*.20) cheaper than Theater B." Instead, most make the decision to buy the popcorn after they've arrived at Theater B, because it as "impulse item."
And even if they do the "40 cents" calculation, Theater B might be selected because other factors (convenience, location, etc.) outweigh the 40 cent extra cost of popcorn (purchased "sometimes"). Put another way, the cost of popcorn is (usually) heavily discounted because of its "remoteness" to other facets of the decision.