I can't seem to find any answer to this on the internet.  Supposedly it takes a lot of memory and server space to host a website-- that's why they aren't free.  So how come github hosts for free?  What's the catch?
GitHub Pages is free to encourage you to use GitHub for everything open-source to encourage you to persuade your company to pay for a business account for their projects

Their business strategy is essentially to be the only place that programmers use for hosting code, so that companies are forced to choose them as well or face the annoyance of all their engineers.