The making of profit, directly or indirectly, by the State Treasurer, tax collector, treasurer of any board of trustees, or any officers whatsoever, out of any money belonging to the state, with the custody of which the state treasurer is charged, by loaning or otherwise using it, or depositing the same in any manner contrary to law, or a removal by the State Treasurer, or by his consent, of such money or a part thereof, and placing it elsewhere than as provided by law, shall constitute a felony, and, on conviction thereof, shall subject the treasurer or other officer to imprisonment in the state penitentiary for a term not exceeding two (2) years or a fine not exceeding five thousand dollars ($5,000.00), or by both such fine and imprisonment; and the treasurer or other officer offending shall be liable upon his official bond for all profits realized from such unlawful use of such funds.