Sales have been on the decline at Macy's (NYSE:M) for nearly three years. As a result of this disappointing trend, the company has been closing stores at a steady pace. Between late 2015 and early 2016, Macy's closed 40 stores. It has closed more than five dozen additional full-line stores in 2017. Macy's has sold off many of these store buildings to mall owners and other third parties to cash in on their real estate value.

Despite this downsizing, there are still dozens of malls across the U.S. that have not just one but two -- or even three -- Macy's stores. Let's take a look at the origins of this bizarre situation and whether it represents an opportunity for Macy's.

An historical accident

Some malls have multiple Macy's stores because the company outgrew its original building or could not find enough space in one location. However, more often, the existence of multiple Macy's stores in the same mall can be traced to the company's long history of mergers, the last of which was the Federated-May Company merger of 2005.

The exterior of the Macy's Home and Furniture store at South Coast Plaza

South Coast Plaza is one of the malls with multiple Macy's stores. Image source: Macy's.

When most of these mergers occurred, the department store business was much healthier than it is today. As a result, when competitors that merged had stores in the same mall, they usually kept both stores open. Closing one store and selling the associated real estate (or terminating its lease) meant running the risk of a rival department store moving in.

In most cases where Macy's has two stores in the same mall, it has divided up the merchandise by category. For example, one store may hold the Men's and Home collections, while the other store has everything else. In other cases, two stores in the same mall have broad overlap in their merchandise.

Dual Macy's stores: A surprisingly common setup

The existence of two Macy's stores in the same mall isn't some rare anomaly. At the beginning of this year, roughly 100 Macy's stores had another store in the same mall or a stand-alone furniture store within a few miles.

That said, many of the stand-alone furniture galleries are quite small. Additionally, in some malls, the two Macy's stores are each undersized, making it necessary to operate both in order to present a full range of merchandise. In most of these cases, consolidating to a single store wouldn't be worth the cost.

Still, even among full-size Macy's stores with at least 100,000 square feet of space, nearly three dozen had a second Macy's store of at least 100,000 square feet in the same mall or across the street. In these cases, it would clearly be feasible to slim down to a single store, leaving a substantial piece of real estate that could be sold or returned to the landlord.

Making tentative moves in this direction

In a few cases, duplicate stores have been part of Macy's recent downsizing initiative. This summer, Macy's closed one of its two stores at Simi Valley Town Center in California and one of its two stores at the Mall at Tuttle Crossing in Ohio. It also sold its Men's Store building in downtown San Francisco in early 2017. That location will close in a couple of years and its merchandise will be integrated into the Macy's flagship store across the street.

Yet for the most part, malls with two Macy's stores have avoided the chopping block. There's a simple reason why that's true: Many of the malls with multiple Macy's stores are among the company's most successful locations.

The exterior of the Macy's San Francisco flagship store, viewed from Union Square

Macy's will soon operate a single flagship store in San Francisco. Image source: Macy's.

In fact, two-thirds of the malls with multiple Macy's stores of at least 100,000 square feet are listed among Macy's 150 best-performing locations. Clearly, Macy's is making a lot of money at these malls and doesn't want to rock the boat.

Closing duplicate stores could still be smart

Even for the most successful Macy's locations, it's not clear that operating two full-size stores in the same mall still makes sense. Hardly any department store chains are still expanding, so it's no longer likely that a direct competitor would move in. (Off-price retailers represent a bigger threat in that respect, but they need much less space for each store, so they could probably find space with or without Macy's help.)

Furthermore, the top-performing Macy's stores are in some of the best malls in the country. This means that they sit on extremely valuable real estate, so there is a high opportunity cost to maintaining the extra square footage of a second store.

For example, Sears Holdings recently sold its store at South Coast Plaza in Southern California to the mall owner for a staggering $187 million. There are three Macy's stores at that mall, with a total of 564,000 square feet of space -- plus a 291,000-square-foot Bloomingdale's.

It's possible that none of the duplicate Macy's stores are worth that much. But many of them are worth tens of millions of dollars. Furthermore, in consolidating to one store per mall, Macy's should be able to retain a high proportion of the sales it gets from malls with multiple stores -- and an even higher proportion of the profit -- by focusing on the most popular merchandise in the remaining store while offering a deeper selection online.

Thus, the potential real estate windfall and working capital savings from consolidating to one store could easily outweigh the lost profit from downsizing at malls with multiple Macy's stores. In short, Macy's management should think long and hard about whether it is still worth having multiple stores in some of the country's best malls.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.