Well, I mean, generally, any tools you create on company time, with company resources, are assigned to the company, if you're an employee.
Companies, specially big consulting companies do something similar to their clients all the time when inflating projects and time, but, somehow, that just sound like business as usual.
I can't think of a state where a program you create to automate your job, that you wrote on company time, wouldn't be the companies property. Of course an employment contract can easily modify the general rule.
For contractors the rule is the opposite. They retain IP by default.
If someone hires you to cut the grass, and you create a machine that does it (the "Yardba"(tm)), there's no reason that machine would belong to the employer - creating it was not a part of your job.