The cost of memory chips is surging as artificial intelligence devours global supply, pushing prices higher for everything from laptops to smartphones.