First, let's set up some rules for less vs. lower and more vs. greater:
"less" and "more" are used for comparisons of uncountable nouns: "I have much more work today", "I have much less work than you".
"lower" and "greater" are just the comparative versions of "low" and "great", so just like any other comparative word ("taller", "smarter", etc.), they can only be used for things that can be low or great to begin with: "Can you turn the volume lower?" (since "the volume is too low" is perfectly acceptable), "The number of students in the audience was much greater today" ("a great number of students" is also fine). It may seem a little strange to consider the noun "number" as "great", but because we use "greater than" to compare numbers in everyday speech much as we do in math, "great" can be used to refer to numbers.
As you've discovered, the countable/uncountable distinction can get a little fuzzy, so I recommend using this rule if it's more natural for you to test whether using "lower" or "greater" is acceptable in any given context:
Is "X is low/great" grammatical? If yes, then "X is lower/greater" is grammatical as well. stringworm
1) Machines cost banks less.
Here, "less" doesn't refer to "cost", since "cost" is used as a verb in this sentence. The best way to look at this sentence is to assume there's an implied object: Machines cost banks less [money]. Money is uncountable ("I need more money", not "I need 5 more moneys"), as opposed to something like dollars, which are countable.
stringworm
2) Energy costs are lower at night.
3) The costs of getting the inventory are greater
4) The number of students is much lower than...
5) There was a lower rate of bank failure
6) Had a greater rate rate of return
You'll notice that all of these confusing ones are referring to pretty math-y nouns ("cost", "number", and "rate") that can all be described as "low" or "great", which is why we can use "lower"/"greater" consistently.
Let me know if you have any other questions, and I'd be happy to help!