There's no such thing as being overpaid if you're not an executive (i.e., you have no real control over the business, you're just a paid employee). The business is paying you based on market conditions, and if they could get away with it, they'd pay you less. They're paying software engineers that much because that's what the market demands: there's not enough qualified talent to meet the employers' demand.
SW engineers are paid more than other engineers in the US because there just isn't that much work, or demand, for other engineering disciplines here. A lot of the work has gone offshore: as an engineer with a EE degree, I don't do EE work because there just isn't that much of it here. All the electronics work has gone to Asia, except in the defense sector. What the US is still really good at is software: look at all our highest-valued tech companies, and all the other companies in Silicon Valley: an overwhelming number of them are doing software work. Smartphones, all the apps running on them, etc., are all software, and are a huge part of the economy now. Not to mention all the other places software is now used, such as finance, where it's used by non-tech companies to enhance their business. If it weren't for software, the US economy probably would have collapsed some time ago.
Therefore, with software being a driving force in the US economy, and a shortage of qualified talent compared to demand (plus a lot of workers that are incompetent...), wages have been driven up compared to other engineers.
Finally, if you look at real engineering wages compared to the past, inflation-adjusted, engineers were paid more back in the 60s or 70s or so, and had more job security too. So it's become a less attractive career than it was in the past, so software engineering is really just a holdout.
As for Europe, AFAICT, engineers are just horribly underpaid there, and they try to make up for it some with extra perks like job security.