Why some microcontrollers have so high price/performance ratio?
First, DigiKey single quantity prices are no indication of anything useful.  If you want to make relative price comparisons between PICs, go to the Microchip Direct web site and see what they are actually selling for in at least 100 quantity, although 5000 quantity will be a better guide.

Second, the 16F877A is a old part.  It is probably using a older silicon process with larger feature size, and therefore its die is larger than newer parts even when they have more stuff on them.  Silicon chip prices are mostly about die size, and a little bit about volume.  I suspect the old 16F877A is large and low volume.

This is a normal thing in the semiconductor business.  As feature sizes shrink with new fab technology, newer parts become more capable and cheaper.  Sometimes if the manufacturer thinks the part would be competative at the new smaller feature size, they redesign it for that process in what's called a "die shrink".  However, other technology is usually advancing with microcontrollers so fast that the effort to invest in a die shrink is better spent designing a new part.

At least Microchip understands that it's a pain to redesign a old product because parts went obsolete.  They have been very good about making old parts available, but of course as the volumes go down it's understandable the price goes up.  You can still buy a 16F84, for example, but it will cost more and do less than newer parts.  At least it's still available.  Other manufacturers just stop production and then you're screwed.