Same way that private corporations ensure money is spent where it is intended to be spent.
Fire (read: impeach/do not re-elect) those that do not their job by spending money not for its intended purpose. Discover this by regular, full, public audits.
Prosecute those who commit embezzlement and larceny and send the to prison if convicted. Make them serve long prison stints with no hope of parole for having violated their position of public trust and bar them from holding public office or lobbying positions on penalty of more punitive prison time.