This question really forces one to think about the role that quantity plays in the competitive equilibrium. The two main points that, I think, explain the way this works are:
- The market quantity is endogenous
- In competitive equilibrium, the market clears
I think the thing that is perhaps causing confusion here is that, recalling that it is a true statement that "P = MC" in competitive equilibrium is not sufficient enough to understand the way in which markets function. It is imperative to recall why this is true: because so long as burger sellers maximize profit and burger eaters maximize utility, then quantity will adjust to make it true.
In other words, "P = MC" is not a transcendental tautology that simply must be true under all conceivable circumstances; it is the end result of the rational actions of buyers and sellers interacting within the framework of a market mechanism.
The original question only appears to be a puzzle if you attempt to abstract away from quantity, and allow yourself to imagine that it's not important how those burgers came to be sitting under the heat lamp in the first place.
A fully proper answer to this question would require being explicit about the objective functions of both the suppliers and consumers in this market, but I think that the following shorthand might suffice to illustrate the point:
In the original question, there are really two distinct notions of "marginal cost." The first is that of the marginal cost to produce the burgers. The second is the somewhat different concept of the marginal cost of delivering the completed burgers to the customer (ie, taking them out from under the heat lamp and handing them to the customer). Being sloppy in our use of language, and unintentionally blurring the line between these two distinct costs is, I think, another way to describe the ultimate source of confusion in this example. Let's just be clear, using clear notation.
Call "MC1" the marginal cost of producing each burger. Let's say for the purposes of illustration that each burger costs $2 to make.
Call "MC2" the marginal cost of handing a completed burger to the customer. As in the example, let's assume that this is equal to 5 cents per burger.
Hopefully it does not require too much convincing to establish that, in competitive equilibrium, burger sellers will end up collectively supplying exactly the amount of burgers, Q, for which it is true that the prevailing price of a hamburger is exactly equal to MC1.
It's also true that, in this equilibrium, each burger seller can sell all the burgers that they have chosen to produce at a price of P = MC! = $2/burger, since the market clears.
Now, at this point, each burger seller has already chosen a quantity of burgers to produce. So even though it's true that, once the burgers have been made, their production cost is a sunk cost, and from that point, the marginal cost of delivering the completed burgers to a customer is only equal to MC2 = $0.05, it will still be the case that no seller has any incentive to charge any less than P = MC1.
Again, this is true because, in the competitive equilibrium characterized by P = MC1 and quantity Q, the market clears. This means that each and every seller of burgers can sell 100% of their stock of completed burgers at a price of MC1 ($2/burger). No seller has anything to gain by offering an even slightly lower price to the market, let alone offering a price as low as MC2.
EDIT: To expound on the above a little...
Perhaps it's helpful to reinforce the role of the (endogenous) equilibrium quantity Q by looking at a graph.
It is certainly true that, for the quantity of burgers that the restaurant has chosen to produce (aka, for the number of burgers that are already sitting under the heat lamp), the marginal cost of delivering those already-made burgers to the customer is MC2 = 5 cents/burger.
But the paragraph above does not fully characterize the full marginal cost function, whose domain extends beyond the equilibrium quantity (" Q* " below). For any burgers beyond Q*, in order to deliver an additional burger to a customer, an additional burger must be produced first. So the marginal cost of any burgers beyond Q* is NOT 5 cents per burger, its $2/burger (strictly speaking, you would have to allow that it costs USD 1.95 to cook the burger and then 5 cents to hand it to the customer).
Recognizing this discontinuity in marginal cost, we can see that the actual marginal cost function looks something like this:
And furthermore, the location of that discontinuity is endogenous as well, since it will always coincide with the quantity chosen by a rational seller (ie, the quantity where the marginal cost of production crosses the demand curve). So even if you wish to take the position that the cost of producing the first Q* burgers is sunk, and should be ignored, it is still impossible to separate the marginal cost of production from the strategic analysis of the problem.
And, of course, to finalize the characterization of the competitive equilibrium, we need to include the demand curve. As you can see, this situation reflects the strategic incentives of the burger seller, where the quantity chosen by the seller is exactly the (only possible) quantity for which P = MC and quantity demanded equals quantity supplied (ie, the market clears).
As described above, the competitive equilibrium is characterized by the intersection of the demand and MC curves, at a quantity Q*, and a price of MC1 = $2.00/burger.
As above, the seller sells all Q* of their burgers at this price, and so has absolutely zero incentive to charge a lower price of MC2 = 5 cents/burger.