Of course "most" programmers come from middle class or lower, as "most" people are probably in your definition of middle/lower class.
What's your definition of "rich"?
If you consider "rich" to be in excess of $100 million net worth, and private jets and stuff like that, then ya, maybe @nick2 is right.
If you consider "rich" to be in excess of $200k/year salary, and up to $10 million net worth... guessing there isn't a huge trend one way or the other. But the general bias is probably towards the middle/upper class vs people who are in the very lower class. Since having some resources (internet, computer, education) is needed.
Digital Media Academy : http://www.digitalmediaacademy.org/ * $1000-$2000 1 or 2-week course
iD Gaming Academy : http://www.internaldrive.com/idga/ * $3,599-$3,799 2-week course
The bitter irony of these programs is that while they probably represent merely "fun, free time" for rich kids, the same skills could be life-changing for average or poor kids.
My anecdote: grew up poor, started programming to build my own games as my family couldn't afford new hardware. Built systems out of scavenged parts and learned a lot about code optimization. Dev is the key factor that lifted me from poverty in suburban England to a middle class life in NYC (and hopefully beyond, should luck pan out).
Most of my peers appear to be from middle/upper middle class backgrounds, but the (faux?) egalitarianism of tech would suggest that the sires of the genuinely rich wouldn't flaunt it as everyone in this industry "made their own success", right? ;)
Sure, I'm not in the 1%. But I'm from a well off family. In my room alone I have 6 computers: a Macbook Air, an iMac, a high-end Ultrabook, two Windows 8 tablets, and a low-end HP Notebook running Ubuntu. Also a Raspberry Pi and an Arduino.
I love programming. It isn't taught at my high school, so I have taught myself since 3rd grade by reading textbooks on my own. I'd list my GitHub, but as I said I don't want to be blacklisted.
So yes, I code. And I enjoy it.
Look at the founders of Google, who came from middle class families, and would have been more than happy to sell Google in the early days for even 1 million dollars.