In all actions or suits prosecuted or defended in the name and for the use of the state, or any county or other public corporation therein, the state or public corporation is liable for and may recover costs and disbursements in like manner and with like effect as in the case of natural persons.