Dollar General Corp. is weighing a bid for Family Dollar Stores Inc. that would challenge Dollar Tree Inc.’s $8.5 billion takeover of the discount retailer, people with knowledge of the matter said.

Dollar General is working with an adviser to evaluate its options and knows that banks are willing to finance a counter bid, one of the people said, asking not to be identified discussing private information. Family Dollar last week agreed to be acquired by Dollar Tree after investors Carl Icahn and Nelson Peltz had pushed for a sale.

While Dollar General had earlier passed on the chance to bid for Family Dollar, the company is re-evaluating its options out of concern that the smaller retailer may soon be out of its reach for good, two people said. There is no guarantee that it will make an offer, the people said, with one putting the chance of a bid at 50 percent.

Family Dollar has traded at or above the $74.50 per share price that Dollar Tree has agreed to pay since that cash and stock agreement was announced on July 28, indicating that investors expect a higher offer. The shares rose Tuesday, giving the company a market value of about $8.8 billion.

The combination of Family Dollar and Dollar Tree — the No. 2 and No. 3 dollar store chains — would leapfrog Goodlettsville, Tenn.-based Dollar General in number of stores to become the largest. With more similarities to Family Dollar, Dollar General may be able to extract even greater benefits from a takeover than Dollar Tree through cost cuts, according to Poonam Goyal, a senior retail analyst for Bloomberg Intelligence.

While Dollar Tree caters to middle-class consumers and sells most items for $1, the other chains both focus on low-income shoppers and offer more food at various price points.

Dollar General hasn’t approached Family Dollar about its interest yet, one person said. Mary Winn Pilkington, a spokeswoman for Dollar General, declined to comment. Representatives for Family Dollar and Dollar Tree also declined to comment.