Xanathar's Guide to Everything (2017) allows crafted magic items to be sold at a profit
Meta: While this question mentions the DMG specifically, it was asked before the release of XGE , and commenter Longspeak brought up XGE recently. Therefore I believe it is appropriate and useful to discuss XGE.
Xanathar's Guide to Everything (XGE) contains updated guidance for crafting and selling magic items in the section on downtime activities. In this answer I will consider XGE as written; however, do note that XGE rules are optional.
Selling (pp. 133-134)
Here XGE gives base prices for items based on their rarity as well as rules for selling items. Depending on the result of the sell check, the offer may be 50%, 100%, or 150% of the base price. It takes one workweek and 25 gp to find a buyer.
Note that
The character can always opt not to sell, instead forfeiting the workweek of effort and trying again later.
Therefore, a character could keep trying until they reach their best possible result.
Crafting (pp. 128-130, 133)
In terms of crafting magic items during downtime, XGE divides them into three categories.
Scribing spell scrolls
This can be profitable but are not the most efficient. The best a character can do is to scribe a 6th-level scroll at a cost of 15,000 gp in 8 workweeks. As a very rare
consumable item it has a base price of 20,000 gp. If the character gets the best result (offer for 150% base price) in a single week of selling, it will go for 30,000 gp. Subtracting the initial outlay and the 25 gp cost to find a seller, that's a profit of 14,975 gp over 9 workweeks, or an average profit of at most 1663.88 gp per workweek (ignoring complications). However, if the character is not very skilled at selling, their average weekly profit will be smaller.
Notably, not all scrolls are profitable to scribe; it is impossible to turn a profit on 3rd, 5th, 8th, and 9th level scrolls even with the best possible sale result.
Crafting general magic items
This costs exactly half the base price. With enough initial funds, rarer items are more time-efficient. A legendary item takes 50 workweeks to craft and sells for up to 300,000 gp; however, it does require 100,000 gp of initial funding. Overall, that's an average profit of at most 3,921.07 gp per workweek.
However, apart from the high initial cost and potential complications, XGE also specifies an additional requirement:
An item invariably requires an exotic material to complete it. [...] Finding that material should take place as part of an adventure.
So this is not actually a strictly downtime activity.
Brewing Potions of Healing
XGE gives one more option, however: potions of healing are treated as a separate category with their own table for crafting time.
A potion of supreme healing costs 10,000 gp and 4 workweeks to brew; as a very rare consumable item, it can be sold for up to 30,000 gp. This comes out to an average profit of at most 3,995 gp per workweek, beating out general magic items. Furthermore, it requires less initial funds and there is no adventure requirement.
I would also interpret there as being no chance of complications during the brewing process:
there's a 10 percent chance for every five workweeks spent on crafting an item that a complication occurs
Emphasis mine. Since each potion takes less than five workweeks to brew, no such item will trigger a complication roll.
Furthermore, the paragraph about brewing potions of healing is after the paragraph on complications, and states:
Potions of healing fall into a special category for item crafting, separate from other magic items.
Emphasis mine. The word "separate" suggests that potions of healing are not subject to the preceding rules for complications to begin with.
Of course, complications could still arise during the sale.
Herbalism kit proficiency
Apart from the time and cost, the only other requirement to brew potions of healing is proficiency with herbalism kits. XGE also updates the rules for training tool proficiencies during downtime (p. 134), which takes at most 10 workweeks and 250 gp. Brewing potions of healing is therefore open to any character, provided that they can find an instructor (or have proficiency with herbalism kits already).