Poor kids get into the NBA because they invest a lot into their physical training and game abilities. You know the 10'000 hours rule.
A ball may be less expansive than a computer, but a free access to a public library and following online programming courses is even less expansive.
IMHO, the only real difference is peer acceptance of an investment in sport, which still ranks much higher (socially) than investing time in computers and learning.
Your assumption that there is a public library available to kids to learn to program on is sadly not true for a lot of rural children. For the majority of my youth, a public library either required a parent's time investment or was not available at all. The situation hasn't changed. Online programming training and tools are also not exactly top notch, and I would not be surprised if the tip off some "dangerous" activity with the librarians.
When we lost the class of computers that the C64, Vic 20, Atari 400/800, TI99/4A, and Sinclairs made up, we lost a lot of the onramp to programming.
A ball may be less expansive than a computer, but a free access to a public library and following online programming courses is even less expansive.
IMHO, the only real difference is peer acceptance of an investment in sport, which still ranks much higher (socially) than investing time in computers and learning.