Now you've gone and made me watch the extras on my DVD again.
In a 1974 BBC documentary made during the filming, Terry Jones says that the plot was completely finalized before filming:
Yeah, I think the Pythons, we usually stick fairly closely to the script, actually. They're usually pretty careful to work out, because they're so involved, usually, you have to stick, you have to work everything out in advance.
Michael Palin confirms; the plot was fixed in advance, but the details of each scene could be improvised:
It's very scripted. And then we get together, and then just about ten minutes before a take, the script is slightly rewritten. And five minutes before the take it's fairly radically rewritten. So in fact at the very last minute there's usually these little extra bits creep in.
Graham Chapman reveals a bit of the plot in his interview:
It's about a search for the Holy Grail (…). People are trying to find this Grail. — Do they? — No. No. — Isn't that rather a letdown? Don't you feel the audience… — It's a big letdown. The whole film has a great anti-climax.
Before filming began, the script underwent a lot of change. John Cleese estimates that no more than 15% of the original script remained by the time filming started. At some point, the plan was to have half the movie happen in the Middle-Ages and the other half in modern times. This is about when the quest for the Holy Grail became the main plot thread; at that stage it was to be found in Harrods (because they have everything).
The historian sequences were added at some point during the writing, well after the first draft. The first historian scene was originally Michael Palin's idea, to speed the plot along. As the scene seemed to go well, the theme was expanded to tie up the plot.
Michael Palin also came up early with the idea to end the film with the police arresting everyone. In The Quest for the Holy Grail Locations, a 2001 documentary, Julian Doyle (production manager, special effects photographer, and the police sergeant who directs the final arrest and covers the camera lens with his hand to stop the film) mentions that he very much liked the idea of the ending (I don't remember if he specifically came up with it).
I didn't hear any mention that the cost was a motivation for cutting parts of the script. Whether it was or not, the ending was clearly planned well before filming began, for artistic reasons to boot, so it's not a case of running out of money.