The U.S. does not have an education problem; it has a child poverty problem.
The problem is the divide between rich, middle class and poor. Poor kids just don't score nearly as high on tests than middle class and wealthy kids.
Of course, I don't have the stats or evidence, but I suspect if you took out our (USA) bottom 20% and the other countries bottom 20%, you would see a much more even comparison.
Just a theory.
While I know this is anecdotal, my wife is a reading/psychology teacher at a high school in Florida that is widely considered one of the worst, if not the worst, in the state. It's incredible the ways in which the students socioeconomic state plays into their ability and/or desire to learn. Everything from the students parents not being capable of or not willing to contribute to their educational growth to peer pressure from other students to not stand out (which includes appearing smarter than others, sadly).
My wife is lucky to be in a position where she can teach them in small groups of 1-3 students and get them away from that peer pressure. In these circumstances, and when someone is believing in their ability to do better, they really do excel and are incredibly bright. It's just like you said, their socioeconomic position has stacked the cards against them for a very long time and it becomes easy to fall into the same rut everyone else is in within those areas.
(Assuming that "immigrant" != "first-generation immigrant, of course, which seems to be in line with your comment.)
IMO is international. And while the US does well, we haven't won since the mid-90s. In that same period of time China has won it like 15 times.
And the last time the US won the ACM Programming Contest is probably equally as long. And there we typically will only place one or two schools in the top 10 at best (although it's not a collection of our best programmers -- it is by school).
Furthermore, U.S. students seem to do fine on exams that require creativity (IMO, Putnam, etc.).
If you want to dig into the data itself, there's a passable interface to it here: http://nces.ed.gov/surveys/international/ide/
A large part of the "problem" seems to be because we're comparing a very large country to much smaller nation-states. Massachusetts outperforms almost the entire world [1]. Ignoring variance and how it relates to group size is a well-known problem. It is, for example, the reason the Gates Foundation erroneously spent $1 billion funding small schools [2]. It's a reasonable thing to think about doing, because small schools outperform large schools. But, small schools aren't only at the top, they're at the bottom, too! Small schools have higher variance. Small countries do, too.
[1] http://nces.ed.gov/timss/pdf/results11_Massachusetts_Math.pd...
[2] http://marginalrevolution.com/marginalrevolution/2010/09/the...