If in any action, judgment upon any motion directed to the complaint, answer or reply, by either party to the action, is entered against the plaintiff, the defendant shall recover costs against the plaintiff. If such judgment is entered in favor of the plaintiff, the plaintiff shall recover costs against the defendant; and the person so recovering costs may collect same in the same manner as judgments for the payment of money are enforced.
735 ILCS 5/5-110