This along with private information you enter on sites to excess e-mail or social networking services.The disclaimer you mentioned that we are agreeing to their terms and conditions is nothing but an open license to the concerned companies to access our data that is acceptable as no one can use their product without agreeing to their terms and conditions.
but its not a problem as far as they retain it inaccessible to 3rd parties.
but in the above case US govt a 3rd party in that context had all such access to all the citizen's data.
And of course this operation is made legal by whatever means only God knows.
I'm pretty sure not only me but every other people can never have a clear idea on this issue and they'll never in future also.
Also don't compare this to doctor patient relationship...