>A company can sell for what ever price it wants.
Sort of... They can choose to produce/sell or not produce/shutdown. The price itself in the EU is enforced to be calculated the same way, as marginal pricing. That is, the price that each one received is the price of the last producer need to meet with the demand.
Say you ned 400MWh and you have this producers available
Generator __ Cost to produce 1 MWh _ Available __ Accepted?
Wind _______ €10/MWh ___________ 100 MWh __ 100 MWh
Nuclear _____ €20/MWh ___________ 200 MWh __ 200 MWh
Gas ________ €80/MWh ___________ 150 MWh __ 100 MWh
Coal _______ €100/MWh __________ 100 MWh ___ 0 MWh
The marginal pricing would be 80€/MWh, because wind and nuclear both account for 300MWh, add the Gas for more 100MWh, you get the 400MWh already, no need to buy from the Coal producer. The last price is 80€/MWh and is what all producers receive. So solar receive 80€ when it cost was really only 10€, gas received 80€ and it was it own price. Coal gets nothing as didn't sold any capacity
This is set to promote cheaper sources and the more expensive ones to be more flexible. This price is calculated in each country and as they are all connected, you also add the next country production to your list. So while you can set your price, what you get is defined by these marginal prices in your country.
This is why companies invest in wind and solar, they are cheaper and faster to deploy, can get paid back quickly. A nuclear plant can take huge amount of years to build, costs a fortune and have a return of investment way longer, while can sell much more capacity.
Notice that marginal pricing in electricity happen all over the world, with some small changes, like also accounting transmission costs in bigger countries/weaker distribution capability