It's hard to imagine that with the stock market running at such a high valuation that there are stocks that Wall Street doesn't view favorably, but there are a few companies that have fallen from grace over the past year for one reason or another. What's even more surprising is when some of those companies hitting rough patches are great businesses that even pay dividends.

Two attractive but out-of-favor businesses are oil refiner HollyFrontier (HFC) and grocer Kroger (KR 0.64%). Here's a quick look at why they're going through a tough time and why you may want to consider buying them now. 

stock market chart

Image source: Getty Images.

A cheap price for a quality capital allocator

The oil refining business has been anything but good lately. Throughout 2016, rising crude prices and high costs for ethanol credits to comply with the U.S. Environmental Protection Agency's renewable fuel standards cut into refiners margins. Unfortunately, that situation hasn't improved much, as high levels of refined product inventory are keeping gasoline and diesel prices lower. As a result, shares of HollyFrontier have been hit with a few body blows and are now down 23% over the past year.

It's true that the oil refining business is cyclical, but there are two reasons that make HollyFrontier rise above the fray: its most recent acquisition and its conservative management team. 

The cyclical nature of the refining business means that management teams need to take measured steps when growing the business so that they don't stretch themselves too thinly with capital investments. Too much spending when times are flush can come back and bite a company if the market turns quickly. HollyFrontier's management has been adept at managing the ups and downs of the cycle. Keeping a very modest balance sheet has provided the firepower to make an acquisition when opportunities present themselves, and avoiding top-of-the-cycle investments has helped the company maintain one of the best returns on invested capital in the business. 

This was on full display with its most recent acquisition of a 15,000-barrels-per-day lubricants manufacturing plant from Suncor Energy. Unlike fuels, lubricants is a much higher-margin product and doesn't fall under the same ethanol compliance regulations. What's even more encouraging is that the company bought the facility for an annual EBITDA multiple range of 2.9-5.8 times depending on the synergies it can pull. Even if it is on the low end, that is a good deal. 

These are moves that make HollyFrontier the kind of stock you want to be on when the industry cycle takes a turn for the worse. Today, HollyFrontier's stock trades at an enterprise value to EBITDA of seven times and a dividend yield of 4.8%. That EBITDA multiple is good but not great for a cyclical stock, but do keep in mind that this is in the trough of the cycle. So, as the refining market returns to a more normal margin environment, it will look pretty good. 

Getting a great grocer at a discount

The past year has been a tough go for Kroger as its stock has declined close to 25%. Much of the losses are related to the fact that the grocery business has been struggling with price deflation. There are also some concerns as the company's debt levels are getting a bit higher than what we are used to seeing with this grocer -- total debt to EBITDA at the end of 2016 was 2.44 times. While that may sound like a palatable figure, keep in mind that the grocery business is notorious for thin margins, and any increase in interest expense is going to be felt on the bottom line. 

While these issues may raise an eyebrow, Kroger has earned a reputation as a very solid operator in this competitive industry. Despite the less-than-ideal price deflation environment, Kroger gained market share at its stores for the 12th consecutive year and held net income per share more or less flat for the fiscal year. 

It should also be encouraging to investors that Kroger's management isn't just resting on its laurels. It sees the changing dynamics of food delivery and online ordering, so it's using the cash flow machine that is its core supermarket to invest in its digital ordering business. Kroger now has 640 locations from its acquisition of Harris Teeter that can be used to fulfill online orders. The company is now testing last-mile delivery options with ride-sharing companies for delivery. Management even admitted on its most recent call that it is taking a few financial hits with some new initiatives, but it believes that the company needs to make these investments for the long-term strength of the company.

This looks like a company that is going through difficult times, but remains well positioned to grow and return value to shareholders. With an enterprise value-to-EBITDA ratio of seven times and a dividend yield of 1.7%, this seems like an opportune time to make an investment in this temporarily unpopular stock.