If, prior to the commencement of an action in a court, a person desiring to commence such action in such court, files with the clerk thereof an affidavit, stating that the affiant is a poor person and unable to pay costs, and that his or her cause of action is meritorious, the clerk shall issue, and the sheriff shall serve, all necessary process without requiring costs; if judgment is entered against such plaintiff, it shall be for costs, unless the court shall otherwise order.
735 ILCS 5/5-107