Plenty of people buy yarn without a project in mind. They find something they love, a great color, a great texture, or better yet a great bargain! It becomes part of his/her stash.
But yes, you have to remember when you do that you likely won't be able to buy any more of it so your future project will be limited by the amount of yarn you have. Of course, you can always "stretch" a great yarn by using it as an accent to a larger project (cuffs, edges, borders, stripes) and mixing it with some other yarn.