I deleted my question and then the bounty amount got refunded, why? This can be exploited to create infinite bounties.
It does indeed appear that your bounty was refunded as part of the question being deleted.
The answer is at When a question that had bounties is deleted, are they automatically refunded? which shows bounties being refunded. This is a feature, not necessarily a bug.
If you were to place a bounty that was successful and/or got an upvoted answer you would not be able to get the bounty refunded after a question is deleted.
Bear in mind that any upvoted answers will block a question from being deleted and as a result will block this kind of abuse.
It is not an "infinite bounties" hack, more it is a refund of wasted points.
In this particular case you lost the points from the two upvotes your question had, and got your points lost as a bounty back.
There is also a question on Meta Stackechange How does the bounty system work?
What happens if a question where I awarded a bounty later gets deleted or migrated?
If a question on which you have started or awarded a bounty on later gets deleted, then in most cases, your reputation is refunded. It can take a few minutes for this to happen. If the question is later undeleted or migration is rejected, the reputation is deducted again.
There is one exception to the above rule, however: if the bounty was awarded to an answer, and the author gets to retain their reputation upon deletion (i.e. their answer earned a score of at least 3 and was visible for at least 60 days), the reputation is not refunded to the bounty starter.