In both cases, the answer is that the great bulk of the financing for the war came from borrowing. This was much easier for the North, with its greater industrial capacity, which made it a better risk for lenders. The South also did a lot of simply printing more money, which was a way to finance the war, but was also disastrous in terms of creating inflation.
As you can see from the eh.net link below (you have to scroll down a ways to get to the part of financing), both the Union and the CSA had to borrow a great deal of money. The USA did get money from excise taxes and tariffs and from the first-ever income tax, but that was not anywhere near to enough money. As a result, it had to get about 75% of the cost of the war from either borrowing money or simply printing more. Luckily for the North, it needed to do only a little printing of money as the war went on. By contrast, the South had to rely heavily on printing money. The CSA had a very hard time borrowing, especially as the war went on and it looked less likely to win.
The war, then, was paid for largely by borrowing. The South also had to print huge amounts of money while the North was able to raise at least a significant percentage of its war costs through taxation.
During the Civil War, the North and the South used a number of methods to fund the cost of fighting. In the North, for example, the government used taxation to raise 21 percent of the necessary funds. This came from a combination of income tax and taxes levied on other products and services, like legal documents, liquor and advertising. While the South also used taxation, it was not as lucrative as in the North, creating only 6 percent of the money needed. (See the first reference link provided).
The South also raised the necessary funds by printing paper money. In fact, this funded about 60 percent of the cost of war, though printing so much money caused a huge increase in inflation. It also borrowed money from the wealthiest people in society, as did the North. (See the second reference link).
Finally, both sides sold war bonds as a means of raising extra money. This tactic was more successful in the North, where wealthy families were encouraged to support the war effort by purchasing bonds, and they did so in their millions. In the South, early bonds sold well but they declined in popularity due to rising rates of inflation (because people realised that their return would not be high). (See the third reference link).