You have to read between the lines a bit. Their system is to store all metadata AND to record all phone calls. They can then go to a judge and get a warrant for calls that took place in the past, and (having previously recorded them) pull them up at will.
And metadata is a very broad term that encompases all data excluding the original. For example, "metadata" for a phone call would include electronically generated transcripts of the phone call. In theory (and probably practice) some algorithm scans these transcripts for keywords; on a match, they get a rubber stamp from a in-house judge, and then pass the records on to a human to do the real work.
Basically, someone figured out that you can use computers to wiretap the whole nation, and then did it. The whole constitution, legal framework, and morality be damned.
This is true in many other governments, but in the USA, the government has no right or ability except what is stated in the agreement with the people (aka Constitution). It specifies exactly what the government can do, and anything not specified is off-limits at the federal level and reserved to the states and the people. The first 10 amendments were largely considered redundant when they were passed, because they were just naming specifics cases of things that were off-limits. A favorite quote from James Iredell (a Justice from the first US Supreme Court):
It would be not only useless, but dangerous, to enumerate a number of rights which are not intended to be given up; because it would be implying, in the strongest manner, that every right not included in the exception might be impaired by the government without usurption; and it would be impossible to enumerate every one. Let any one make what collection or enumeration of rights he pleases, I will immediately mention twenty or thirty more rights not contained in it.
Nowadays, any constitutional restrictions are largely worked around, or completely ignored, by all three branches of federal government. There was originally a check in place to counter expansion of federal power vs state soverenty, but that was removed with the adoption of the 17th amendment.
All programmers are playwrights and all computers are lousy actors.