Clearly NASA isn't always looking to the Balance Sheet and the Profit and Loss account or the shareholders, but if it doesn't do what Congress wants and can't demonstrate its continued usefulness then it doesn't get money. No money no engineers, no spacecraft, no space exploration. So in a sense it is a business, selling its services to the people of the USA, although hopefully the money is secondary to the principles and aims of the engineers.
How can you feel when you're made of steel? I am made of steel. I am the Robot Tourist.
Robot Tourist, by Ten Benson