Yes, it is.
You can purchase domain names and use them however you want—as long as your website content isn’t breaking the law. Buying domains only to resell them is a legal grey area, though, and in some places, it’s completely illegal.