By performing a particular good deed, there is a particular merit that one accrues. Some good deeds fetch a good wife, some other fetches riches, beauty, fame, long life, health and so on. This is true for sins too. A particular sin committed results in poverty, yet another results in childlessness, mental imbalance, cowardice, disrepute and so on.
So if one does the good deeds that fetch him human birth, he is born as a human. He might not have done enough ‘punya’ to enjoy a posh and comfortable life.