Using trainer as dynamo
You could. If you were a hobbyist, it'd be simple enough to hook a DC motor to act as a generator, smooth the output, boost-buck it to the right voltage, and use it to charge a deep-discharge lead-acid battery.

From there, you could either use it to charge your USB equipment or get an inverter to run some lights. I would not hook it into your mains, the equipment to do so safely is expensive.

I'd estimate the setup would cost just around $200-1000 depending on what parts you already have lying around.

===

That said, let's say you already had most of the parts so it only cost you $200.

You could most probably output 100-400 watts an hour. Let's say, you're in very, very, very good health and can do 250 watts for 2 hours a day. That's 500 watt-hours. Over a month, training 20 days that'd be 10,000 watt-hours or 10 kWh. 

In my region, electricity is 20 cents a kWh, so you would be generating $2 a month.

So you would amortize your equipment cost of $200 over 100 months or 8 years. That's if you're in excellent health. 

Note 0: Values chosen for ease of calculation rather than strict adherence to reality. However, I believe they are within an order of magnitude correct.

Note 1:  your energy expenditure will be such that your increased food consumption will likely exceed $2/mo. 

Note 2: if you break or wear out anything, you'd be back to square zero. Even deep discharge batteries have a limited life span.

Note 3: This model doesn't include charge/discharge/inverter inefficiencies. You should most probably multiply everything by 70-80%.

Note 4: this exact scenario was used in an episode of Black Mirror, season 1.