HN itself doesn't make any money, but it serves as a community that attracts people who apply for YC, and in turn generate returns (similar to the playground at a McDonalds). There are other startup accelerators that don't have a community like HN, and they miss out on this source of potential applicants.
Indirectly: brand identity, community building, etc. YC makes money off seed funding deals.
Lots of venture capitalists blog heavily for the same reason.
HN makes YC's investment portfolio more valuable, via: