I have read that the border between Morocco and Algeria is closed. Does it mean that literally it is not possible to cross the border by any means of ground transport (bus, rail, foot)? Is it possible to do it by flying without stopover? Or to go via a neighboring country within a reasonable time and budget?
The border between Algeria and Morocco is closed. A legal ground crossing is not possible at this time.
The only common neighbor is Mauritania. Even if the borders are (legally) open, you will have to cross regions where travel is disadvised.
There are direct flights between the two countries. It depends from where and to where you want to fly. As an example, Air Algérie and Royal Air Maroc have direct flights between Casablanca and Algiers.
There is another possibility, if you want to avoid flying. You can sail from Morocco to Spain, go to Alicante, by train or bus, and sail from there to Oran. There are other options as well, such as Nador - Almeria / Almeria - Oran. You have to search a bit, what is available and possible during the period you want to travel. Some routes are seasonal and ferries do not leave every day.