The Federal law on interception of telecommunications, which is the same as most states', is that an individual may tape a telephone conversation to which that individual is a party without informing the other party to the convesation. Third parties, however, must get court orders to intercept others' conversations.
Some states, like Wisconsin, go beyond Federal law and require direct permission from the party being taped, even if the taping is by the other party to the conversation.
However, in all cases I know of, it's a whole new ball game if the taping is done by or with the cooperation of a law enforcement agency pursuant to a court order. Then there's no need at all for any kind of consent by any of the parties to the conversation that's being taped.
NY I'm almost positive is one of those states like Wisconsin where the other party must be informed ahead of time. In Maryland I sort of remember Linda Tripp getting into trouble for the same thing by taping Lewinsky without telling her. You're right about the courts obviously, they can overrule any state or federal law if there's a criminal investigation going on.