You pay a consultant to take liability. Sure, you could do this in house, but wouldn't you rather have someone outside of the organization use their liability insurance?
A lot of consultants and contractors do the work for different governments. A reason why governments like this is that private companies find hiring and firing a lot easier. So, if a company performs poorly, it is really easy to fire them. In some cases, governments can also get individuals working for the consultant or contractor to stop working on that governments' jobs, effectively firing them.
It can be a lot easier to get rid of a poorly performing consultant over a poorly performing government worker.
That's when the company doesn't do kicks to the project lead, or when you bring your full extended family. In those cases see how everyone will despair while working double and wondering wtf is "company" still working in our project.