"IMO, this suggests the introduction of basic welfare state funded by the increased prosperity. But we can also just waste the extra productivity with a huge military, increased litigation, and a truly massive prison system."
I'd suggest education would be a preferable alternative to either of those.
Food, Shelter, Education, and Medicine all fall under the heading of welfare. A well funded library system is often the first piece of a welfare state. Like health care education can be a great boon to society in moderation or a great drag in excess, but just because it can be useful does not mean it's not welfare.
I'd suggest education would be a preferable alternative to either of those.