Except as otherwise provided by law, costs may be allowed or disallowed in the discretion of the court to any party in any action, motion, appeal or proceeding, whether or not he be successful therein; and where allowed, they may be taxed according to law.
N.J.S. § 2A:15-59