Here is an example of a contract that pays $40 million per year in which the player gets an actual $40 million in cash every year for 4 seasons, but the cap hit changes and ratchets up.
Year 1 - player is paid $40M, 4 M salary, and $36M bonus
Year 1 Cap Hit - $13
Year 2 projected Cap hit - $49M
Year 3 projected Cap hit - $49M
Year 4 projected Cap hit - $49M
In year 2, the team changes the $40M salary to $4M salary plus $36M bonus. The player still gets $40M in cash.
Year 1 - past Cap Hit - $13 (4+9)
Year 2 - Cap hit - $25M (4+9+12)
Year 3 - projected Cap hit - $61M (40+9+12)
Year 4 - projected Cap hit - $61M (40+9+12)
In year 3, the team restructures to pay $4M plus $36M bonus. The player receives $40M in cash
Year 1 - past Cap hit - $13M
Year 2 - past Cap hit - $25M
Year 3 - Cap hit - $43M (4+9+12+18)
Year 4 - projected Cap hit - $79M (40+9+12+18)
In year 4, the player simply receives the final $40M payout in cash for his salary. But his Cap hit is $79M.
In the end, the payout is $40M per year in cash for a total of $160M. The Cap hits also total $160M over 4 seasons (13+25+43+79).
This is the difference between Cash Accounting and Accrual Accounting.