IE had the advantage because Microsoft had the good sense to go for a rewrite of the HTML rendering engine that they acquired from Spyglass. This eventually panned out, and IE4 used this as a basis for many key improvements in rendering, CSS, DHTML, etc
Netscape originally tryed to stick to hacking their Mosaic-age Netscape 1.0 era layout engine, but it was not possible to update this to support faster layout, incremental reflow, real DHTML, etc. So Netscape started their own rewrite: NGLayout/Raptor (later became Gecko) But they started too late, almost 18 months after MS had started rewriting the IE rendering engine.
Getting an HTML rendering engine working bug-for-bug feature-for-feature compatible is a huge undertaking. Mozilla/Gecko/Netscape5 started back in 1998, and you can see that only in the last 2 years has it really become useful.
So to answer your question: Netscape had shitty management, waited too long to commt developer resources to a total rewrite of their core HTML component, whereas Microsoft started alot earlier and got the leg up on them.
It had nothing to do with "Windows APIs". To disprove that theory, just look at IE on the Mac OS, which is superior to IE on Windows in terms of standards compliance.
Simply put, Netscape4 was like the NV30. They tried to take an old architecture, layer a few new features, and send it up against a totally new architecture, and the result was a diaster (for Netscape)
(I am friends with several engineers at Netscape and MS)