Circuit breakers are designed to protect the wiring, not devices plugged into it. With a 15A receptacle, by design, you can't try to plug a single device into it that would exceed 15A, so the wiring is fine with being able to easily supply more in a 20A circuit. You could also look at it like it's fine to use 12g wire on a 15A circuit even though it's capable of handling more power...it can help keep the voltage drop low on a longer run.
Now, why they allow a 50A dryer/stove plug to be used with a 40A breaker doesn't seem as reasonable, but normally, those things are dedicated circuits to a specific device and hopefully, the wiring is sized correctly for that device.