Just so long as Google is paying the NSA, I've got no problem with this. If the police were helping some bank develop protection from thieves who could rob the place and were paying the police, would that be a problem?
Even if they weren't paying, investigating and helping to prevent crime seems within their mandate.