In all actions commenced or to be commenced for and on behalf of the people of this state, or the governor thereof, or for or on behalf of any county of this state, or in the name of any person for the use of the people of this state, or any county, then and in every such case, if the plaintiff recovers in such action, the plaintiff shall recover costs as any other person in like cases; but if the action is voluntarily dismissed by the plaintiff or is dismissed for want of prosecution or judgment is entered against the plaintiff, the defendant shall not recover any costs whatever. Nothing in this section contained shall extend to any popular action, nor to any action to be prosecuted by any person in behalf of himself or herself and the people or a county, upon any penal statute.
735 ILCS 5/5-117