To start with, most boarding schools, like private and public universities, have an endowment fund, which is essentially their nest egg. The money for the endowment fund comes from alumnae donations, donations from other parties (like the parents of the students, or just general supporters of the school) interest on the fund itself from the bank, and outside investments made from businesses and companies.
Financial aid often has its own funding, but can be tied to the endowment fund. Hogwarts had a financial aid fund:
‘I haven’t got any money,’ [said Tom Riddle]
‘That is easily remedied,’ said Dumbledore, drawing a leather money-pouch from his pocket. ‘There is a fund at Hogwarts for those who require assistance to buy books and robes. You might have to buy some of your spellbooks and so on second-hand, but –’
Half-Blood Prince - page 256 - Bloomsbury - chapter 13, The Secret Riddle
Now it is my understanding that any magical child who is accepted at Hogwarts is able to go there; I don't believe Hogwarts charges tuition, if I recall correctly. The fund for children in need is for books, robes, a wand, etc. If Hogwarts charged tuition, how could five Weasleys possibly attend the school at once (Ginny, Fred, George, Percy, Ron)?
I think, based on canon, that the Ministry does not help fund Hogwarts' expenses, otherwise it would have far too much pull at Hogwarts. The Ministry, aside from Order of the Phoenix, doesn't really interfere at Hogwarts.
There is, however, canon evidence that in the Wizarding world, inventions require patents that must be purchased:
‘Level Seven, Department of Magical Games and Sports, incorporating the British and Irish Quidditch League Headquarters, Official Gobstones Club and Ludicrous Patents Office.’ - The Elevator, Ministry for Magic
Order of the Phoenix - page 119 - Bloomsbury - chapter 7, The Ministry of Magic
I'm not quite sure how patents work in the UK. Here in the US, I believe the inventor who wishes to take out a patent pays for the privilege to do so, from their own private funds. I don't know if any of Dumbledore's inventions were patented. There's the Deluminator, but would he have wanted to disclose the full capabilities of the Deluminator to the patents office? Dumbledore truly doesn't strike me as a man who would even bother to fuss about patents. If he did, though, I'm not sure why anyone other than himself would pay for the patent. As well, any money that came from the patent portion of the sale of an invention would seemingly go to the Ministry as some kind of taxation, with the rest going to the patent holder. I don't think any money would go directly to Hogwarts.
I can't find any evidence in canon that suggests there are taxes in the Wizarding World. I could be entirely wrong on this, though. It kind of goes back to the question on Gringotts on whether or not the Goblins pay interest on their deposits. If there are taxes in the Wizarding World, then undoubtedly some might go to Hogwarts, just as taxes here (US) go to fund education. If it's different in the UK, please leave a comment and I'll adjust this accordingly.
The Malfoys contribute a lot of money to causes that they feel will ingratiate themselves with persons in positions of power, which is mostly the Ministry of Magic. I couldn't find any information on the Malfoys contributing money to Hogwarts, although Lucius Malfoy did provide the Nimbus 2001 brooms for the Slytherin Quidditch team in 1992. Malfoy 1, 2, and 3
There's the Fountain of the Brethren inside the atrium at the Ministry of Magic, which people throw coins into. I would have to figure out how much the average fountain makes in change per year and then convert it from Wizarding currency to pounds/dollars ... But again, there's no guarantee that the money from the fountain would go to Hogwarts.
Hogwarts is home to many magic antiquities, such as the Sword and Gryffindor and the Diadem of Ravenclaw (until it was destroyed in Deathly Hallows), the Sorting Hat, and the jewels in the house hourglasses. I would imagine this is but the tip of the iceberg and that Hogwarts has many, many more priceless items sequestered away. NOTE: This is just my guess, that Hogwarts has a lot of treasure-like items in store. It's not canon.
Canon doesn't specify where Hogwarts' money comes from, as far as I know. So I'm going to suggest that Hogwarts has an endowment fund or the Wizarding equivalent, and that's where its income comes from, to pay teachers, stock the school with supplies, take care of the students, maintain the Hogwarts Express, and provide food and drink for the students.
Remember, also, that they utilize slave labor in the form of house-elves. Can you imagine how much money that must save them? Not a small amount, I'd wager.