In the first Back to the Future movie, Doc Brown seems to have a fairly large amount of money. He has his own house, a camper, a Delorean (which was a fairly expensive car), which he didn't seem to be scared of losing in time or breaking, etc. He obviously had enough funds for his inventions for decades, most of which at least looked like they would require expensive components.
Furthermore, when Marty goes to meet him in 1955, he seems to live in a much larger house (Brown Mansion).
I can't recall any dialogue or backstory explaining where he gets his money in the movies. in 1955, He is super happy (and surprised) to hear that he finally built something that works. I assume he hasn't been living off selling his inventions in that case, at least not before 1955.
Did he inherit a large sum of money? Does he have a (very lucrative) side-job besides inventing, considering he must know a thing or two about physics at least?
I'm looking for an in-universe answer, but if none exist, any details or explanation from the writers would be fine.