Ok so ♠Cmndr. Gresh♠ brought up some good points but I know the answer being that Gamefreak don't care how they make money. Why go into little details 1/100 people may want to know but is not even worth knowing? That said I can only assume it is funded by either the Pokemon league or the community.
This is what I found on Bulbapedia
>Kaz Gym
This Gym in Dark City wanted to become an official Gym to earn money, but was rejected by the Pokémon League. It has Pokémon of various types, but its primary Pokémon is an Electabuzz. This Gym appears in Showdown at Dark City and is run by Kaz.
Yas Gym
This Gym in Dark City wanted to become an official Gym to earn money, but was rejected by the Pokémon League. The Gym Trainers specialize in Fighting but the Gym Leader's Pokémon is a Scyther. This Gym appears in Showdown at Dark City and is run by Yas.
So if we go by this source gyms make money by being official if you get what I mean. Not from outside sources like a mine or Elctricity plant. I can assume they are funded by the Pokemon League.
This is probably the most accurate answer you could get, that said it still is a bit of speculation though the source does back me up.