their primary difference can be defined as two companies that have different : business models
Amazon provide a medium so other sellers could sell their books through their sites. This way, they won't need any space for their house cause they sell other's product.
Meanwhile, barnes and nobles is a book retailer, which means they produce and put their own books to the stores.