You're right to some extent but it looks like the only cap on an appeal to federal court is the 25%.
See the following SSA guide. There's a chapter on fees.
http://www.ssa.gov/pubs/EN-05-10075.pdf
It also appears that you pay certain expenses in addition to the fees.
For example: Medical records, expert testimony, transcripts of trials and hearings, and who knows what else. Those last two alone could run into tens of thousands above your attorney's fees. So make sure you have the conversation with your lawyer about specific costs that you might incur in addition to his own fee.

