From what I've seen, if HP is tied for the highest stat with another stat, the Pokemon will grant HP EVs. While I'm not quite sure if this is always the case, some examples are Jirachi, Mew, Victini, etc. This also happens with Caterpie (HP- 45; Speed- 45), and probably others.
Why? Probably because it's an easy go-to stat, I suppose. It would be hard to decide what stat to put as the EV yield if the stats are tied, or if the HP is tied with another stat. So it's just easier to give them all an HP EV yield. Victini and Jirachi have the same exact stats, but what if Victini gave 3 Attack EVs and Jirachi gave out 3 Defense EVs? What would be the logic behind that? HP is a bit different from other stats, and, like I stated, it's very easy to just make them yield HP EVs as opposed to choosing with stat; not to mention that would raise more questions about the logic behind them.
Hope this helps! :)