To add on to what Caulfield said, the amount of money you have in the offseason is impacted by the amount of money you save up during a season.
There are people who have studied the system far more than me, but this is my understanding of it.
A team's spending budget during the offseason is based on a combination of performance, market, money saved from the current season, and money saved from past seasons. When the offseason ends and spring training begins, an in season budget is set based on current salary commitments, market and predicted profits (which I assume are related to last year's performance). All of the excess money is skimmed for future offseasons and "profit" (meaning it disappears) except for a 5 million grace which is put in the bank. Money will be added or taken away from the bank based on how well you stay on budget.
The simplest way to put it is: If you want a lot of cash to spend in the offseasons, save as much money in the bank as possible while also winning games.
To clarify the luxury tax: It's a soft cap, meaning that every dollar you spend over the soft cap will cost you two dollars.