It can get pretty expensive if you're isolated (distance penalty), haven't founded a religion, your opponent is spending EPs on you, has "defensive spies", or if your target city has a Security Bureau.
Defensive Spies don't increase the EP cost, just the hammer cost (they eliminate your spies)
The EP factor is almost always going to be in your favor since it Doesn't depend on how much your opponent is spending on you , but on how much both of you have spent on Everyone
If you are running an Espionage Economy that is in your favor
Assuming none of the Religion bonuses
x80% open borders
x ~70% EP bonus
x 50% Spy settled
x 150% (EP base cost v. Flask base cost)
x 150% Security center
x~130% (bonuses you get to researching a tech with prerequisites or if other civs know it)
Ends up with about 82%
That is with no distance penalties
so if you can do it with minimal distance penalties (or Holy city Religion Bonuses to off set those penalties) then it is balanced out
Farther away.. favors self research
The more civs that have it.. favors self research
The more prerequisites you have... favors self research
The more of it you already have researched.. favors self research
Espionage points Easier to get.. favors Espionage
Religious bonuses.. favors Espionage
Culture that you have in the city.. favors Espionage