There are topics about that issue, but I know the search funtion here is horrible.
Anyways, it's true, you need to be over level 20, but the issue is actually that you have done too many quests, most likely. Once you did everything for the Jarl, the option to buy the house is gone.
However, if you stay neutral in the civil war until a certain part of the main story where the two quest lines intersect, you will have the chance to make Markarth have a new Jarl and from him, you will be able to purchase the house. Or you wait for a patch to fix this issue.