CVS Health Corp. (CVS) - Get Report said Friday that it reached a multi-year agreement with Walmart (WMT) - Get Report to maintain its retail pharmacy Medicaid network and pharmacy benefit management systems after warning earlier this week that the two companies had parted ways.

CVS had argued that Walmart's required rates to maintain the system would result in higher drug prices for customers, but noted Friday that the two sides had reached a "a mutually agreeable solution", although terms of the deal were not disclosed.

"We are pleased to have reached fair and equitable terms with CVS Caremark that are in the best interest of our customers, and we are glad our CVS Caremark customers will be able to continue saving money and living better," said Walmart senior vice president Sean Slovenski. "We believe in putting our customers first by providing value and keeping our everyday low-price promise."

CVS shares rose 3.4% Friday to close at $65.52 following news of the contract renewal, while shares of Walmart -- the world's biggest retailer -- added 1% to end at $97.73.

Jim Cramer and his team of analysts at his Action Alerts PLUS club for investors had argued earlier this week that the dispute with Walmart doesn't alter the pending industry disruption facilitated by the integration of Aetna. 

"For some earnings perspective, analysts at Cowen estimated that Walmart's departure will have at most a $0.07 impact to 2019 adjusted earnings, which is less than 1% of their current $7.50 estimate," the team wrote. "And if the April 30, 2019 request is agreed upon, Cowen estimates an impact of at most $0.05 to 2019 adjusted earnings per share."

CVS reports on February 20.

"When we strip out the noise and the immaterial impacts, what we are left with is a stock that trades at a very compelling valuation," the team said. "The below 9x consensus 2019 earnings multiple reflects too much discounting, and the dividend yield above 3% provides us with plenty of compensation for our patience in the integration process."

(This article has been updated with closing stock prices.)