This answer discusses the flash version.
Defending against PvP attacks is not a good idea. Every incoming attack is attached to an uncaptured tile next to your base; when you do the defense, you defend on the map for that tile. If you win the defense, you capture the tile. The rewards for winning the defense seem to just be the rewards for capturing the tile. If you want to capture tiles, it's much simpler (and lower-risk) to do that directly, rather than in response to PvP attacks.
Deliberately losing to PvP attacks is very low-risk. Once every 24 hours, you spend all your money, then lose to each attack in turn. If you don't have money, the attacks will wreck your buildings, but the most damage you can ever take is to have your super monkey villas wrecked for four hours. If you lose your battles before logging off for the day, the damage won't be a problem for you.
(I imagine the situation changes once you buy all your upgrades, as agent86 has done. I'm not there yet.)
Making PvP attacks is occasionally valuable, because sometimes your opponent won't use the above strategy for losing to PvP attacks, and they'll accidentally lose a lot of money to you. My city is level 27; out of my last ten attacks, I had the following results: won 18450, won 2000, lost, lost, won 2000, won 11550, won 6871, won 2000, lost, won 22410.
Note that these attack wins give you money even if your banks are full. If you need to build a very expensive item, you may not be able to hold enough cash to buy it normally, but getting a PvP win at the right time could let you buy it.
When choosing a target for an attack, the random matcher will often match you against someone you can't send a max-power attack against (because your tanks don't hold that much bloontonium). One workaround is to friend a bunch of random people and then use the "attack friend" button to choose a target that is low enough level that you can attack them for the max power they can receive. I don't usually do this, though -- it takes time to scroll through my friends list to find a good target, and attack power doesn't seem to be very correlated with cash from attacking.
In conclusion, PvP is a decent way to make money, but it does not produce experience or bloonstones, beyond what you'd normally get for capturing tiles. The main cost to PvP is the cost (both in money and in city tiles) of building all the stuff needed to send attacks.