Demand from AI data centers has led to a surge in memory chip prices, taking a toll on sales, margins of leading consumer electronics makers.