What if you opt for the 12-month pay but quit your position before the end of an academic year? (For example, give 30-days notice in December). Do you forfeit your 3 months of distributed pay that would have been paid over the summer months?
This probably depends widely on country (etc.), but the most logical solution would be that if you have fulfilled X% of the contracted duties then you are due X% of the agreed upon salary.
There might be penalties charged, however, if you cause disruption and it is expensive to find a replacement. But that isn't related to pro-rating. But any signed contract should spell that out, perhaps in a clause referring you to a stated policy.
But pro-rating the salary, when there are no duties over the extra three months is just an accounting trick that makes it possible for faculty to have a regular paycheck, easing their own financial considerations. It isn't a "gift" in any way that can be withheld. You have earned the money for the work you've done.
The HR department can help you answer the specifics if you are actually contemplating this. It probably isn't necessary to consult a lawyer unless bad things actually happen.
In my experience, your pay stubs will actually itemize "summer savings" separately -- so you'll see the full 9-month salary, and then among your other deductions (taxes, etc.), you'll see that 1/4 of your salary is applied to a "summer savings" account. Whatever money is in that savings account when you quit will be paid out to you; it is your money that was paid in consideration of duties already performed. Whether it is paid out immediately or over the summer as planned will depend on your institution's policies (though I suspect immediately is more likely, so they can "close the book" on you).