You are right. .NET gethostbyname actually calls getaddrinfo in some cases. getaddrinfo returns the addresses in "correct" order which gethostbyname does not on Windows. Hence the discrepancy. tried a native app which calls both and confirmed the difference.
Thanks everyone.