I have looked into this. Under federal student loans, the Income Based Repayment plan provides for forgiveness of the remaining balance after 25 years. You can log in to your online loan account and play with the calculator to see what the payments would be. The payments are based on a percentage of your income above poverty level. I saw a write up of a plan to use this advantageously. Basically, if your adjusted gross income is around $24,000 or less, no payment is due in the following year. If you make more, but contribute the remainder to a 401k, you can stay under that threshold. This applies to middle & low income people who don't expect to be high earners in the future. One suggestion I heard was for folks who are already FI. It would then be possible to go back to school on loans, and given modest future income, never repay the loans. Note, repayment is based on income, not assets. I am not suggesting this, just playing devil's advocate. I don't expect the numbers to work out well for high earners, but play with the calculator and see.
Really, the forgivess is there for low income earners. I know an artist who doesn't expect to earn above 25,000 a year for their lifetime, and thus expects to have their loans forgiven in another 16 years.
Also, in terms of future law changes, I would expect the prior payment plan you agreed to will be grandfathered in. I currently have a repayment plan with fed loans that is no longer available, but my terms have not changed.