I think there's a third, which is when the company is so rich it just doesn't matter. Then saving even a little bit of employee time (which are more likely to be the bottleneck in such a company) is worth basically infinite spend.
I worked at a place where they spent $6k/month on cloud, just for a Java app not doing much plus a PostgreSQL database. I came up with a way to save $2k/month (better indexes), when I did it nobody cared or even noticed I think. I know that $2k/month might not sound like much, but I think the same principle would have been true even if it'd been much more. They spent about $2m/year on an external software development agency to create a React project, full of inefficient scrum meetings and billable hours from project managers and so on, and they didn't really care about that either.