McKinsey & Company agreed to pay $650 million in a deferred prosecution agreement that will resolve a federal criminal probe into the company’s consulting work advising Purdue Pharma on how to increase sales of its opioid painkiller OxyContin, a court filing said Friday.