Sweden is divided into four price regions for electricity, SE1..4 from north to south.
Demand for power in SE4 (most south) comes from domestic use, and from export from SE4 to Denmark, Germany, Poland (typically, flows can also reverse).
The most expensive supplier sets the current price. Let's say domestic supply is 2 GW. Domestic demand is 1.7 GW and export demand (Denmark, Germany, Poland) is 0.7 GW.
The missing supply is solved by importing from Lithuania to SE4 (1.7 + 0.7 - 2 = importing 0.4 GW); this becomes the most expensive power supplied at this instant and sets the current electricity price in SE4 for domestic users and for those that receive the export. (So we have cheap Swedish electricity for the most part, but the expensive Lithuanian production sets the price in this example.)
In this way, SE4 has enough domestic supply to cover domestic demand. Imports are smaller than exports, but the imports still push up the price for everyone.
Note that import/exports are both on the synchronous grids where applicable as well as using HVDC connections.
In practice the loss of cheap gas from Russia results in higher demand (and price) for alternative sources of energy, including electricity, in those countries that relied on Russian gas. And since they are connected to the Nordics via the grid, it also spikes electricity prices in the Nordics. For energy producers this is great, but for consumers in the Nordics it is not good at all.
The analogue to the internet fails in the sense that you don’t have constraints with domestic production with internet data like you have with energy.
If country A has plentiful production but country B hasn't, the companies of country A are better off exporting to country B, but this will make prices go up in country A.
Definitely not a good thing for the average citizen of country A, which would be better off with a disconnected grid.