To rephrase, some things are not directly profitable but tend to have outsized profitable effects. E.g., the education budget doesn't directly generate profits, but educated people go on to get good jobs and pay a lot of taxes, refunding the cost of their education by many multiples.
The same goes for roads, highways, and rail. Not directly profitable, but they enable a lot of free movement that boosts the economy and, in turn, taxes.