Does it cost universities less to teach online?
Consider the University of California system as an example: of its core funds expenditures, three quarters goes to employees, and most of the rest is student financial aid. Only 6% of the costs go to equipment, utilities, and similar.
Now, some portion of those employees would also become unnecessary if they did away with a physical campus entirely, but most are still needed to operate the organization. In the case of an institution like the UC system, remember also that much of the physical campus is also not devoted to instruction, but to research and other non-instructional activities, and these have continued in many cases (albeit with reduced capacity) through the pandemic.
In short: in the near term, most universities' costs are almost entirely identical while teaching online. In the long term, even if they shed every physical aspect of instruction, the costs would not go down all that much unless the institution was radically restructured to greatly increase the numbers of students per instructor.
There are two possible interpretation of your question, which lead to different answers.
- Consider a University, which made a strategic choice to teach all/most of their courses fully/mostly online. Assuming they had a good team to properly consider the administrative and academic issues and to prepare high quality courses. A prominent example in the UK is Open University. There are no/small costs for Estates. The costs for salaries is roughly the same or slightly smaller (staff still benefits from saving commute costs and opportunity to live in cheaper more distant areas). As a consequence, their bills are smaller and they can charge less for their courses. Today, a BSc in Maths at the Open University costs £6k per full-time year while a similar course at U Essex costs £9k. The answer is yes.
- Now, suppose a normal University like the University of Essex is suddenly forced to move teaching online. Their Estates bill remains more or less the same (Estates remain on the balance and require maintenance). The salaries remain the same. Additional funds are required to develop the necessary IT infrastructure for online delivery, equip academics with all they need for teaching from home, train staff and/or recruit extra specialists to re-develop courses for online delivery (e.g. develop substitutions for labs, etc). In this situation, the urgent switch to online teaching actually costs more, so the answer is no.
It probably depends on the course
A major cost of offering an undergraduate Biology course (and presumably other science and engineering courses I have less experience of) is practicals. These consume expensive materials, and require substantial additional support in the form of PhD students who are paid to assist in the laboratory, as well as taking multiple technicians and academic staff to deliver the classes.
There is no online equivalent to these practical elements, and so their absence likely represents a substantial saving to the university, and their loss is a significant deficit in the education such students are receiving.
For other courses, such as Mathematics, teaching is likely no cheaper and probably actually requires additional time from the teaching staff compared to in-person teaching. Since these staff are salaried they probably aren't being paid by the hour anyway, I leave debating whether this is really a "cost" to other people who are fond of arguing.
But any analysis of the cost of teaching is missing the point
The amount universities charge for a degree is down either to government regulation (as in the UK) or the market value of a degree to the student but either way the university is not totting up a value for the education delivered and charging the student an itemised bill for that; it is deciding what income it need, or can get, and is charging accordingly.
(Note: since these seems directed at the current situation rather than Online in general, I am considering only the costs of a traditional university providing temporary online teaching not the comparison to full distance learning as a long term decision.)