Real world conditions like the one that you edited out of the sentence you quoted. The point is that neither exercise perfectly mimics the job the OP is being considered for, and they fail to do so in different ways.
There is no mention of "working on a pre-existing codebase that they know nothing about" in the description of the HackerRank test... so I don't know how your point applies?
Sure, it's very hard to fully approximate that aspect of the job in a quick coding screen. Small algorithmic problems don't come close in the grand scheme of things. But they still put you in an environment and context where you don't have the advantage of being an expert ahead of time.