In 2005 McDonald's net profit margin was ~12%, today it's ~30+%. Obviously that doesn't account for the entire price increase and wouldn't make that much of a difference...but worth noting.
I'm not sure where this number comes from but McDonald's profit margins may be misleading due to their franchise and real estate based model. If you spend $10 at McDonald's that's paid to the franchise and the central McDonald's corporation isn't necessarily profiting $3.
McDonalds business model is to own real estate and lease it to franchisees, and to sell those franchisees supplies to make hamburgers and fries so they can pay the rent.
It’s a commercial real estate company with extra steps, not a restaurant company. Once you understand that, McDonalds net margins are easier to understand.
Google ‘McDonalds real estate’ for a longer write up about the business model of McDonalds