It usually isn't sustainable, but can be helpful during launch of a new game to make sure it gets attention. I think it was easier than cracking the Top Free list, since fewer apps have IAP.
The ad team at my previous game company would do this and not tell the rest of the rank-and-file employees. We'd be psyched to see our app in the top grossing list... meanwhile the ad team would be spending more money than we were earning.
another interesting thing, basically everyone on the top grossing chart knows roughly what the others are making - as you adjust ad spend you adjust your revenue, and when you pass someone you know how much they are making. (or just through word of mouth or multiple games)
even more crazy was buying tens or hundreds of thousands of downloads to get to the top of the free charts from bots, before apple claimed to be cracking down, which then triggered a couple percent of that in legitimate downloads. those 'organic' downloads from the charts ended up costing a fraction of what paid ads would have cost if you average the bot download cost over them. then marketing/coo lying about not using bots......dont know why they thinks they can hide stuff from the engineers
Is this allowed?
It's like opening a restaurant and paying people to eat there for a while to generate fake social proof.
First 100 people through the door get 15% off!
Beta testers get the full game half price!
And of course, authors do this on the NYT Best Seller list all the time... buy enough copies of your own book at enough book stores and you'll shoot right to the top: https://en.wikipedia.org/wiki/The_New_York_Times_Best_Seller...
If your book/game is crap, the it will fall again, you lost your money and your spot in the charts.
The only difference between giving someone a coupon to entice them to buy something from you and buying it yourself is how much money you're losing in the short term. It's on the same spectrum, just at different ends.
Offering a discount or giving copies away is marketing.
Buying copies yourself and pretending someone else did is fraud.
New York Times would definitely care if they had reason to believe a book on their Best Sellers list was having its sales inflated. In fact, they mark those books specifically with a dagger next to them and the practice of price manipulation is a subject of on-going controversy which is presumably costing the list some prestige. 
... or what they're spending on advertising :)
As for the calculations, Apple updates roughly every six hours and I think (the algorithms not being public for a good reason, I have no real proof), they take into account the total sum revenue during the last period, but also use the relative delta revenue as a factor, so even with slightly lower revenue a suddenly popular app can appear higher in the rankings.
They also seem to change the algorithms every once in a while, we've seen pretty drastic changes overnight a few times, eventually though the top apps always normalize around the usual suspects, so it's possible that they just do some sort of reset of historical data that also affect rankings.
The better way to think about the list is "top grossing apps for Apple/Google". Their 30% cut is what they're counting there.
EDIT: some research later indicates that it's possible allowing a user to sign up outside the app (and outside a webview initiated by the app) skirts around the policy , since the user can return to the app and log in, then use their account for payments.
All digital content (premium features, game coins, file storage, music or video libraries) accessible within the app must be charged through Apple, and the user must not be able to find an alternative payment method from within the app.
> EDIT: some research later indicates that it's possible allowing a user to sign up outside the app (and outside a webview initiated by the app) skirts around the policy, since the user can return to the app and log in, then use their account for payments.
Depending on the precise details of your signup page, this may or may not get banned by Apple if they notice it. It's allowed to sign up users and accept external payments outside the app - but then you must not have links to this payment page from within the app. If the user already has an external paid account, then they can use it, but any first-time users must only see IAP or nothing.
Some time ago Apple threatened to ban Dropbox, because they had a webview for signups, and it was possible to upgrade to a premium account within that webview.
It includes both in app purchases and cost to buy.