They make money off the code hosted on Github, which is by-and-large open source. Github makes money off of open source software whether they themselves run open source software (almost certainly yes) or not.
The question posed is how does github make money off of OSS in a way that other similar services do not. Since they all host OSS software in one form or another, that observation isn't relevant.