An unexpectedly large moderation in the Fed’s preferred inflation gauge cheered investors, lifting stocks to their third straight weekly gain.