Assuming that it is cheaper to buy train tickets in advance, I looked at the raileurope web site. and found two type of trains going from Gothenburg to Copenhagen on July 24th: One that takes almost 4 hours at $79, and one that takes less than 3 hours at $30.
Both are economy. It surprises me that there is that much difference, and that the faster train is the cheaper. Am I looking at it correctly?
Do not look at Raileurope. It is a reseller. It may be giving you the best prices, but many people report it does not always list all trains and/or offer the best prices.
I would start my research here: https://www.seat61.com/international-trains/trains-from-Copenhagen.htm#Copenhagen-Malmo
Lots of information and instructions how to book.
I would be suspicious of any site offering prices in '$', they don't use '$' in Sweden or Denmark! 9/10 times the best place to look is the company running the trains.
You are looking at that correctly. But see if you can buy at this site
https://www.sj.se/en/home.html#/
The slower, more expensive trains are regional trains operated by Oresundstag. They don't offer any discounts for advance purchase - you can buy your ticket at the station right before you travel for exactly the same fare, so if flexibility to travel at any time is important to you, they could be an option to consider.
The faster, cheaper trains are operated by SJ, which does offer very substantial advance purchase discounts. The downside there is that you need to commit to a specific train in advance, and the cheapest fares sell out over time.
You can compare it with information from Danish State Railways https://www.dsb.dk/en/
I just did this last week. I went to the SJ office in the train station in Gothenburg and when I told the lady where I wanted to go, she was like "go over there, you'll save money" and we ended up buying a ticket on the regional train from a non SJ office. It was just as nice and took maybe 30 minutes longer, but we were able to get all the way to the main train station in CPH. It was also a more "locals" experience. Also I got my wife a cool Pipi Longstocking bus pass holder at the ticket office we went to which was a plus!
The train ride is really lovely, protip is to sit on the right hand side so you can see the coast!
I forget what all I paid because it was for work, but it was probably about what you quoted.