I can't speak to the legality, but it sure sounds like they violated the terms and agreement in place with AP repeatedly. I wonder what recourse AP has and if they could choose to disallow their content entirely on Fox? It seems like most news organizations get a majority of reporting from AP. I can only imagine the detrimental impact to Fox News if that came to pass.
They're not a "news" organization. They're corporate media, entertainment. They even lost one of their certifications as a "trusted news source" for blatantly lying and regurgitating internet memes without checking their sources.
That's great and all, but their behavior and actions are that of a news agency regardless, so wouldn't they have to face the same scrutiny as a news agency?