Did I calculate maximum price of machine correctly? Problem:

A firm wants to buy a machine for its factory. It will work for two years. During the first year it will yield 240 thousand roubles and during the second year it will yield 200 thousands roubles. We need to caclulate maximum price that the firm will agree to pay for the machine. And one important thing: instead of investing money in the machine the firm can put said money in a bank, interest rate per year is 20%.

I concluded that the maximum price for machine is about 306 thousand roubles. My reasoning was following: If the firm will make the investment it will get 440 thousands of roubles in total (240+200=440). If instead of buying the machine the firm will put 306 thousand roubles in its bank account, then after 2 years it will get about 440 thousands of roubles. Such price makes the firm indifferent between said two options. But if the price will be higher than 306 thousand roubles, then it will make more sense to put the money in a bank account.

I got about 306 thousand of roubles by using this formula:



Where $ F_v $ is total sum of money in the future, $i$ is interest rate, $t$ is number of years and $P_v$ is initial sum of money that we need to put in our bank account in order to yield $F_v$ after $t$ years.

Therefore:



But solution in my textbook says that maximum price is 338.9 thousands roubles and that I must calculate it by using this formula:



Where $π_t$ is revenue for given year and $i$ supposedly means something like "rate of inflation" (i.e. how fast money lose their value)

Thus:



But such solution doesn't make sense to me. Firstly, here $i$ means different thing, it's rate of devaluation of money, not interest rate. Secondly, with price equal to 338.9 thousand roubles it's clearly more profitable to put the money in a bank, because we will get about 488 thousand roubles after two years, instead of 440 thousand roubles.

UPDATE 01:

If we take all revenue that the machine yields at the end of the first year and put them in bank, then our total revenue after two years will be 488 thousand roubles instead of 440 thousand roubles. Considering this, now I agree that 338.9 thousand roubles is maximum price. 

But I still don't see why we need NPV to calculate this and why $i$ must mean inflation, when it means annual percentage rate
The thing you are missing in your calculation is that the roubles the machine produces in year 1 are more valuable than those in year 2.  Think about 2 different machines with different production schedules


Machine 1 - 440 roubles year 1, 0 in year 2
Machine 2 - 0 in year 1, 440 in year 2


Using your calculation the value of both of those machines would be the same about 306 roubles, but machine 1 produces the goods in year 1.  So in year 2 you can put those roubles in the bank and earn 20 percent interest on them.  So at the end of 2 years you actually have 528 roubles instead of 440.  

What the NPV calculator is doing is taking into account the production in year 1 is worth more than the production in year 2 by dividing it by a smaller number, $(1+0.2)$ instead of $(1+0.2)^2$.

Regarding the part about $i$ meaning different things.  $i$ is how we tell how muc we value a dollar today relative to tomorrow.  In the real world inflation makes things in the future cost more so we discount future dollars by that amount.  In your problem a dollar I save today is worth 1.20 tomorrow so if I invest that money in a machine I better earn at least that much otherwise I'd rather put it in the bank.

Explanation of NPV:
Think of there being 2 different machines.  One gets you 240 in one year.  The second gives you nothing in the first year but 200 in the second.  Using your calculations you would say you'd pay 
$$ \frac{240}{(1+0.2)} = 200 $$ 
for machine 1 and 
$$ \frac{200}{(1+0.2)^2} \sim 138.9 $$
for machine 2.  Thus you better be willing to pay 338.9 for a machine that does the work of machine 1 and machine 2. That is all NPV is doing here.